citation-file-format / cff-initializer-javascript

Web form to initialize CITATION.cff files.
https://citation-file-format.github.io/cff-initializer-javascript/
Apache License 2.0
21 stars 8 forks source link

Fetch authors from DOI #19

Closed sverhoeven closed 2 years ago

sverhoeven commented 3 years ago

The citation of a DOI can be requested using content negotiation. See https://citation.crosscite.org/docs.html

For example

curl -LH "Accept: application/vnd.citationstyles.csl+json, application/rdf+xml" https://doi.org/10.1038/s41589-020-00724-z |jq .author[1]
{
  "ORCID": "http://orcid.org/0000-0002-5821-2060",
  "authenticated-orcid": false,
  "given": "Stefan",
  "family": "Verhoeven",
  "sequence": "additional",
  "affiliation": []
}

In JS it would be

(await (await fetch('https://doi.org/10.1038/s41589-020-00724-z', {headers: new Headers([
    ['Accept', 'application/vnd.citationstyles.csl+json']
])})).json())['author'][0]

if not for CORS problerms

jspaaks commented 2 years ago

Closing this until we have a better idea of what #466 looks like.