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

Provide JSON for user agent curl #18

Closed
acka47 opened this issue Jan 17, 2024 · 4 comments
Closed

Provide JSON for user agent curl #18

acka47 opened this issue Jan 17, 2024 · 4 comments
Assignees

Comments

@acka47
Copy link
Member

acka47 commented Jan 17, 2024

When looking up a concept URI with curl I expect to get back JSON but I do get HTML.

Example:

$ curl -LI "https://w3id.org/kim/hcrt/drill_and_practice"
HTTP/1.1 302 Found
Date: Wed, 17 Jan 2024 11:19:32 GMT
Server: Apache/2.4.29 (Ubuntu)
Access-Control-Allow-Origin: *
Location: https://skohub.io/dini-ag-kim/hcrt/heads/master/w3id.org/kim/hcrt/drill_and_practice
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 200 OK
Date: Wed, 17 Jan 2024 11:19:32 GMT
Server: Apache/2.4.52 (Ubuntu)
Content-Location: drill_and_practice.en.html
Vary: negotiate,accept,accept-language,Accept-Encoding
TCN: choice
Last-Modified: Wed, 10 Jan 2024 13:20:47 GMT
ETag: "4c4a-60e974c90c064;60e974c912dc4
Accept-Ranges: bytes
Content-Length: 19530
Access-Control-Allow-Origin: *
Content-Type: text/html; charset=UTF-8
Content-Language: en

We should configre the webserver as for lobid where I do get JSON with the default user agent set by curl. It probably makes sense to just copy the respective web server config from lobid.

@sroertgen
Copy link
Contributor

We should also document this configuration as an example in the README

@Phu2
Copy link
Contributor

Phu2 commented Jan 17, 2024

In order to get json you should provide the request header: curl -L "https://w3id.org/kim/hcrt/drill_and_practice" -H "Accept: application/json". I don't think it is a good idea to rely on the user agent.
As for lobid i haven't found any web server config in this regard.

@sroertgen
Copy link
Contributor

sroertgen commented Jan 25, 2024

@acka47 we just found out that this now works after merging skohub-io/skohub-vocabs#279

We think this is because Apache is not trying to parse languages anymore, since Content-Language: en is not present anymore in the header.

Closing this now.

@Phu2
Copy link
Contributor

Phu2 commented Jan 25, 2024

For clarification: curl sends per default Accept: */* (as one can see using the -v option)

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

3 participants