Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformatted url responses by SWORD API #4586

Closed
chStaiger opened this issue Apr 15, 2018 · 5 comments
Closed

Malformatted url responses by SWORD API #4586

chStaiger opened this issue Apr 15, 2018 · 5 comments

Comments

@chStaiger
Copy link

I installed a dataverse testserver and using port 8080 for HTTP requests as suggested in the install guide. I observe some strange behaviour when using the FQDN or IP address for posting requests for datasets:

When I am using 'localhost' to list a dataset the request answer is as expected:

curl -u $TOKEN: http://localhost:8080/dvn/api/data-deposit/v1.1/swordv2/statement/study/hdl:21.T12995/KODBWV

<feed xmlns="http://www.w3.org/2005/Atom"><id>https://localhost:8080/dvn/api/data-deposit/v1.1/swordv2/edit/study/hdl:21.T12995/KODBWV</id><link href="https://localhost:8080/dvn/api/data-deposit/v1.1/swordv2/edit/study/hdl:21.T12995/KODBWV" rel="self"/><title type="text">New Test</title><author><name>Staiger, Christine</name></author><updated>2018-04-15T11:33:02.986Z</updated><category term="latestVersionState" scheme="http://purl.org/net/sword/terms/state" label="State">DRAFT</category><category term="locked" scheme="http://purl.org/net/sword/terms/state" label="State">false</category><category term="isMinorUpdate" scheme="http://purl.org/net/sword/terms/state" label="State">true</category></feed>

However, when using the ip address, the answer looks like this:

curl -u $TOKEN: http://$HOSTNAME:8080/dvn/api/data-deposit/v1.1/swordv2/statement/study/hdl:21.T12995/KODBWV

<feed xmlns="http://www.w3.org/2005/Atom"><id>https://145.100.59.118:8080:8080/dvn/api/data-deposit/v1.1/swordv2/edit/study/hdl:21.T12995/KODBWV</id><link href="https://145.100.59.118:8080:8080/dvn/api/data-deposit/v1.1/swordv2/edit/study/hdl:21.T12995/KODBWV" rel="self"/><title type="text">New Test</title><author><name>Staiger, Christine</name></author><updated>2018-04-15T11:33:02.986Z</updated><category term="latestVersionState" scheme="http://purl.org/net/sword/terms/state" label="State">DRAFT</category><category term="locked" scheme="http://purl.org/net/sword/terms/state" label="State">false</category><category term="isMinorUpdate" scheme="http://purl.org/net/sword/terms/state" label="State">true</category></feed>

For some reasons the API doubles the port.

@chStaiger chStaiger changed the title Malformatted url responses by API when using non-standard ports Malformatted url responses by API Apr 15, 2018
@pdurbin
Copy link
Member

pdurbin commented Apr 15, 2018

@chStaiger thanks for opening this issue! As I mentioned at IQSS/dataverse-client-python#46 (comment) this is due to the SWORD API having "https" hard coded and how it sometimes puts in a port when it shouldn't: https://github.com/IQSS/dataverse/blob/v4.8.6/src/main/java/edu/harvard/iq/dataverse/api/datadeposit/UrlManager.java#L185

The workaround for now is to use https://demo.dataverse.org for testing APIs or to install a test server running https and having the dataverse.siteUrl JVM option set to not have a port (so that it runs on the standard https port ( https://dataverse.example.edu or whatever). Please see

Sorry for the inconvenience!

@pdurbin
Copy link
Member

pdurbin commented Jul 13, 2018

@chStaiger is the workaround I described above enough for you or are you still interested in a fix?

@chStaiger
Copy link
Author

The workaround works and I also added some extra lines in the python API to be sure that if Dataverse is not configured that way, that the python api calls are formed correctly.
See here: https://github.com/chStaiger/iBridges/blob/f10b0907b74b6cc627e4842fc08eca1003577253/clients/dataverse/dataverse.py#L16

@pdurbin
Copy link
Member

pdurbin commented Aug 20, 2018

@chStaiger ok. At some point we should remove the hard-coded "https" but I'm glad you figured out a workaround!

@pdurbin pdurbin changed the title Malformatted url responses by API Malformatted url responses by SWORD API Nov 6, 2019
@pdurbin
Copy link
Member

pdurbin commented Nov 6, 2019

At some point we should remove the hard-coded "https"

I just mentioned this at #6296 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants