Honour q parameter in accept headers
This is a bit of a nitpick tbh.
The API does not honour the q parameter on accept headers. It will incorrectly return return application/orcid+xml when sent Accept headers in the form:
curl -H 'Accept: application/orcid+json, */*;q=0.1' 'http://pub.orcid.org/search/orcid-bio?q=digital-object-ids:10.1087/20120404';
It's fairly easy to get around by ONLY accepting application/orcid+json but some clients (like jQuery ajax) will add the */*;q=0.1 to the accept types by default even when you ask them to accept only a certain mime type.
(at least that's my reading of how accept headers should work http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - I'm happy to be corrected here)
This is a great suggestion and something we’d like to fix, but I’m not sure when we will have the time to get to it. Right now the ORCID team is focused on fixing major bugs and rolling out promised features and we won’t be able to address this suggestion for many months. But we appreciate the feedback and do want to implement your suggestion; I’m marking this idea as postponed until we are able to add it to our development timeline.
1 comment
-
Tom Demeranville
commented
As a side note on this, returning JSON when asked for application/json would be great!
For anyone else who's interested, it's the difference between this jQuery code which fails:
$.getJSON("/pub.orcid.org/search/orcid-bio/",{q:"digital-object-ids:"+doi})and this jQuery code which works:
$.ajax({dataType:'json',
url:'/pub.orcid.org/search/orcid-bio/',
data: {q:"digital-object-ids:"+doi},
accepts: {json:'application/orcid+json'},
headers: {Accept : "application/orcid+json"}
})note: you must manually set the headers not just the accept type to override the */*;q=0