XML API - doi.crossref.org/servlet/query?qdata={xml}

Q

How to use XML API URL, doi.crossref.org/servlet/query?qdata={xml}, for DOI-to-metadata query?

✍: FYIcenter.com

A

XML API URL doi.crossref.org/servlet/query?qdata={xml} allows you to query for metadata with an XML query.

This XML API supports the following parameters:

pid={email} - Required. The email address to identify yourself.
format={format} - Optional. The format for the returning XML: xsd_xml, unixsd or unixref.
id={doi} - Required if "data" is not provided. The DOI of the research paper.
qdata={query_xml} - Required if "id" is not provided. The XML string of the query.

The "qdata={query_xml}" parameter supports 3 styles of XML queries:

1. Standard XML query. For example:

<?xml version = "1.0" encoding="UTF-8"?>  
<query_batch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  version="2.0" xmlns="http://www.crossref.org/qschema/2.0"  
  xsi:schemaLocation="http://www.crossref.org/qschema/2.0 http://www.crossref.org/qschema/crossref_query_input2.0.xsd">
  <head>
    <email_address>support@crossref.org</email_address>
    <doi_batch_id>ABC_123_fff</doi_batch_id>
  </head> 
  <body> 
    <query key="1178517" enable-multiple-hits="false" forward-match="false">
      <issn match="optional">15360075</issn>
      <journal_title match="exact">American Journal of Bioethics</journal_title>
      <author match="fuzzy" search-all-authors="false">Agich</author>
      <volume match="fuzzy">1</volume>
      <issue>1</issue>
      <first_page>50</first_page>
      <year>2001</year>
      <article_title>The Salience of Narrative for Bioethics</article_title>
    </query>
  </body>
</query_batch>

2. Unstructured (formatted) citation. For example:

<?xml version = "1.0" encoding="UTF-8"?>  
<query_batch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  version="2.0" xmlns="http://www.crossref.org/qschema/2.0"  
  xsi:schemaLocation="http://www.crossref.org/qschema/2.0 http://www.crossref.org/qschema/crossref_query_input2.0.xsd">
  <head>
    <email_address>support@crossref.org</email_address>
    <doi_batch_id>ABC_123_fff</doi_batch_id>
  </head> 
  <body> 
    <query key="8517117" enable-multiple-hits="true">
      <unstructured_citation>Hungate, B. A., & Hampton, H. M. (2012). Ecosystem services: Valuing ecosystems for climate. Nature Climate Change, 2(3), 151-152.</unstructured_citation>
    </query>
    </body>
  </body>
</query_batch>

3. Multiple queries. For example:

<?xml version = "1.0" encoding="UTF-8"?>  
<query_batch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  version="2.0" xmlns="http://www.crossref.org/qschema/2.0"  
  xsi:schemaLocation="http://www.crossref.org/qschema/2.0 http://www.crossref.org/qschema/crossref_query_input2.0.xsd">
  <head>
    <email_address>support@crossref.org</email_address>
    <doi_batch_id>ABC_123_fff</doi_batch_id>
  </head>
  <body> 

    <query key="query1" enable-multiple-hits="false" forward-match="false">
      <issn match="optional">15360075</issn>
      <journal_title match="exact">American Journal of Bioethics</journal_title>
      <author match="fuzzy" search-all-authors="false">Agich</author>
      <volume match="fuzzy">1</volume>
      <issue>1</issue>
      <first_page>50</first_page>
      <year>2001</year>
      <article_title>The Salience of Narrative for Bioethics</article_title>
    </query>

    <query key="query2" enable-multiple-hits="true">
      <unstructured_citation>Hungate, B. A., & Hampton, H. M. (2012). Ecosystem services: Valuing ecosystems for climate. Nature Climate Change, 2(3), 151-152.</unstructured_citation>
    </query>

  </body>
</query_batch>

If you want to try to submit a query with the "qdata={query_xml}" parameter, you need to encode query XML as a URL string. Here is a request that sends the about 2-query XML to doi.crossref.org. It returns 2 matches. Remember to remove those line breaks if you want to try the "curl" below.

fyicenter$ curl 'https://doi.crossref.org/servlet/query?pid=email@address.com
&qdata=%3C%3Fxml+version+%3D+%221.0%22+encoding%3D%22UTF-8%22%3F%3E+%3Cquery
_batch+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+
version%3D%222.0%22+xmlns%3D%22http%3A%2F%2Fwww.crossref.org%2Fqschema%2F2.0%22+
xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.crossref.org%2Fqschema%2F2.0+http%3A
%2F%2Fwww.crossref.org%2Fqschema%2Fcrossref_query_input2.0.xsd%22%3E+%3Chead%3E+
%3Cemail_address%3Esupport%40crossref.org%3C%2Femail_address%3E+%3Cdoi_batch_id
%3EABC_123_fff%3C%2Fdoi_batch_id%3E+%3C%2Fhead%3E%3Cbody%3E+%3Cquery+key%3D%22
query1%22+enable-multiple-hits%3D%22false%22+forward-match%3D%22false%22%3E+%3C
issn+match%3D%22optional%22%3E15360075%3C%2Fissn%3E+%3Cjournal_title+match%3D%22
exact%22%3EAmerican+Journal+of+Bioethics%3C%2Fjournal_title%3E+%3Cauthor+match
%3D%22fuzzy%22+search-all-authors%3D%22false%22%3EAgich%3C%2Fauthor%3E+%3Cvolume
+match%3D%22fuzzy%22%3E1%3C%2Fvolume%3E+%3Cissue%3E1%3C%2Fissue%3E%3Cfirst_page
%3E50%3C%2Ffirst_page%3E+%3Cyear%3E2001%3C%2Fyear%3E+%3Carticle_title%3EThe+
Salience+of+Narrative+for+Bioethics%3C%2Farticle_title%3E+%3C%2Fquery%3E%3Cquery+
key%3D%22query2%22+enable-multiple-hits%3D%22true%22%3E+%3Cunstructured_citation
%3EHungate%2C+B.+A.%2C+%26amp%3B+Hampton%2C+H.+M.+%282012%29.+Ecosystem+services
%3A+Valuing+ecosystems+for+climate.+Nature+Climate+Change%2C+2%283%29%2C+151-152.
%3C%2Funstructured_citation%3E+%3C%2Fquery%3E+%3C%2Fbody%3E+%3C%2Fquery_batch%3E'
 > output.xml 

15265161,15360075|American Journal of Bioethics|Agich|1|1|50|2001|full_text|query1|10.1162/152651601750079104
1758-678X,1758-6798|Nature Climate Change|Hungate|2|3|151|2012|full_text|query2|10.1038/nclimate1398

 

XML API - doi.crossref.org/search/doi?doi={doi}

XML API - doi.crossref.org/servlet/query?id={doi}

Crossref.org DOI Database

⇑⇑ DOI - Frequently Asked Questions

2022-10-08, 334👍, 0💬