EBISPOT / OLS

Ontology Lookup Service from SPOT at EBI
http://www.ebi.ac.uk/ols
Apache License 2.0
96 stars 40 forks source link

Double URL encoding for term URIs #495

Closed bbartley closed 2 years ago

bbartley commented 2 years ago

Using the ontologies/so/terms endpoint to look up a Sequence Ontology term via the URI, I ran into this issue with URL encoding.

If I URL encode the term URI, then I receive an HTTP 400: http://www.ebi.ac.uk/ols/api/ontologies/so/terms/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FSO_0000167

However, if I URL encode the URI twice, then I receive an HTTP 200: http://www.ebi.ac.uk/ols/api/ontologies/so/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FSO_0000167

What is the rationale for requiring the URI to be doubly encoded?

Thanks!

henrietteharmse commented 2 years ago

To be dead honest, I have no idea. Moreover, even if we find that we do not need double encoding, we will still need to main this endpoint as-is since many users today use it in this way.

bbartley commented 2 years ago

Thanks @henrietteharmse ,

I would simply recommend documenting this fact on the API documentation page. Even though there might be a perfectly valid reason for doing it this way, it wasn't immediately obvious to me, and others like me might become discouraged trying to figure it out.

The example request on the doc page is also double URL encoded. I put it into a URL decoder tool, and noticed that I had to decode the URL twice in order to recover the term URI. That's how I figured this out.

curl -L 'http://www.ebi.ac.uk/ols/api/ontologies/go/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FGO_0043226' -i -H 'Accept: application/json'

Thanks!