Caution about DOIs and Brackets

Summary

If anyone has experienced seemingly random behavior concerning DOI look-ups, exchanges, or requests, hopefully this will help. Through troubleshooting, we have found that brackets ( [ or ] ) in DOIs can cause serious problems if they are not properly encoded as %5B and %5D , respectively.

ORCID API

When posting a new ORCID work via the API, we noticed that 5 items were rejected due to an ‘invalid anyURI’. Here is the complete error returned by ORCID’s API:

400 - Bad Request https://api.orcid.org/v2.1/0000-0002-7591-7898/work

Body: {  "response-code" : 400,  "developer-message" : "400 Bad request: invalid JSON - cvc-datatype-valid.1.2.1: 'https://doi.org/10.1638/1042-7260(2002)033[0029:pofils]2.0.co;2' is not a valid value for 'anyURI'.",  "user-message" : "Invalid JSON.",  "error-code" : 9047,  "more-info" : "https://members.orcid.org/api/resources/troubleshooting"}

After encoding the brackets https://doi.org/10.1638/1042-7260(2003)34%5B0003:pofils%5D2.0.co;2 we were able to successfully post the new work.

Full post

POST https://api.sandbox.orcid.org/v2.1/0000-0002-9361-548X/work

Body: {"title":{"title":{"value":"Pharmacokinetics of florfenicol in loggerhead sea turtles (Caretta caretta) after single intravenous and intramuscular injections"},"subtitle":null,"translated-title":null},"journal-title":"Journal of Zoo and Wildlife Medicine","short-description":null,"type":"JOURNAL_ARTICLE","publication-date":{"year":{"value":2003}},"citation":{"citation-type":"BIBTEX","citation-value":" @article{stamper_papich_lewbart_may_plummer_stoskopf_2003, title={Pharmacokinetics of florfenicol in loggerhead sea turtles (Caretta caretta) after single intravenous and intramuscular injections}, volume={34}, DOI={10.1638/1042-7260(2003)34[0003:pofils]2.0.co;2}, number={1}, journal={Journal of Zoo and Wildlife Medicine}, author={Stamper, M. A. and Papich, M. G. and Lewbart, G. A. and May, S. B. and Plummer, D. D. and Stoskopf, M. K.}, year={2003}, month={Mar}, pages={3–8}}"},"external-ids":{"external-id":[{"external-id-type":"doi","external-id-value":"10.1638/1042-7260(2003)34[0003:pofils]2.0.co;2","external-id-url":{"value":"https://doi.org/10.1638/1042-7260(2003)34%5B0003:pofils%5D2.0.co;2"},"external-id-relationship":"SELF"}]},"contributors":{"contributor":[{"contributor-orcid":null,"credit-name":"M. A. Stamper","contributor-email":null,"contributor-attributes":{"contributor-sequence":null,"contributor-role":"AUTHOR"}},{"contributor-orcid":"0000-0002-7591-7898","credit-name":"M. G. Papich","contributor-email":null,"contributor-attributes":{"contributor-sequence":null,"contributor-role":"AUTHOR"}},{"contributor-orcid":"0000-0003-0716-1387","credit-name":"G. A. Lewbart","contributor-email":null,"contributor-attributes":{"contributor-sequence":null,"contributor-role":"AUTHOR"}},{"contributor-orcid":null,"credit-name":"S. B. May","contributor-email":null,"contributor-attributes":{"contributor-sequence":null,"contributor-role":"AUTHOR"}},{"contributor-orcid":null,"credit-name":"D. D. Plummer","contributor-email":null,"contributor-attributes":{"contributor-sequence":null,"contributor-role":"AUTHOR"}},{"contributor-orcid":null,"credit-name":"M. K. Stoskopf","contributor-email":null,"contributor-attributes":{"contributor-sequence":null,"contributor-role":"AUTHOR"}}]}}

Response

201 - Created https://api.sandbox.orcid.org/v2.1/0000-0002-9361-548X/work

Crossref Search & Link

We believe this might also be affecting Crossref’s Search & Link workflow. For some time, we had noticed that it was impossible to add certain citations using the “Add to ORCID” button in Crossref.

10%20PM
Screen Shot 2019-04-18 at 3.14.10 PM.png768×289 47.6 KB

Clicking ‘Yes’, shows an error that the user’s ORCID sign-in has expired, even though the user can immediately add the next citation.

37%20PM

The cause of this error may be that Crossref’s payload to ORCID is being rejected because of the unencoded brackets. This may be affecting other third parties as well.

Crossref API

The Crossref API does not require encoded brackets (copy and paste the url below
https://api.crossref.org/v1/works/10.1638/1042-7260(2003)34[0003:pofils]2.0.co;2

But, depending on your application’s HTTP request library, a call to the API might cause your application to balk. For example, a simple CURL call requires encoded characters:

$ curl -X GET -k -H 'Content-Type: application/vnd.orcid+json' -i 'https://api.crossref.org/v1/works/10.1638/1042-7260(2003)34[0003:pofils]2.0.co;2'
curl: (3) [globbing] bad range in column 61

$ curl -X GET -k -H 'Content-Type: application/vnd.orcid+json' -i 'https://api.crossref.org/v1/works/10.1638/1042-7260(2003)34%5B0003:pofils%5D2.0.co;2'
 HTTP/1.1 200 OK
 Content-Type: application/json;charset=UTF-8
 Vary: Accept
 Access-Control-Allow-Origin: *
 Access-Control-Allow-Headers: X-Requested-With
 Content-Length: 1347
 Server: http-kit
 Date: Thu, 18 Apr 2019 18:47:23 GMT
 X-Rate-Limit-Limit: 50
 X-Rate-Limit-Interval: 1s
 Connection: close

 {"status":"ok","mes
...

Website URLs

Additionally, the article’s DOI does not resolve on either Pubmed or the publisher’s own site!

However, this was difficult to assess because some text editors, markdown parsers, and even email applications (such as Gmail) automatically encoded the URL, but displayed the un-encoded text.

For example, this post was written in markdown, and the markdown parser used to convert the text to html has encoded the brackets. Therefore, clicking the link will resolve, but copy and pasting the link into your address back will cause it to fail.

https://doi.org/10.1638/1042-7260(2003)34[0003:pofils]2.0.co;2

In short, always encode the brackets of a DOI.

<a href="https://doi.org/10.1638/1042-7260(2003)34%5B0003:pofils%5D2.0.co;2">
  https://doi.org/10.1638/1042-7260(2003)34[0003:pofils]2.0.co;2?
</a>
1 Like

Through troubleshooting, we have found that brackets ( [ or ] ) in DOIs can cause serious problems if they clickercounter.org are not properly encoded as %5B … First, a few rules … Rules are shared by all DOI registration agencies. … -._;()/ (hyphen, period, underscore, semicolon, parentheses , forward …This video tutorial helps explain the basics of Brackets. Get the best test prep review for your exam!
se brackets inside parentheses to create a double enclosure in the text. · 2 . Separate citations from parenthetical text with either semicolons (for …