# JSON schema for content negotiation

**URL:** <https://community.crossref.org/t/json-schema-for-content-negotiation/2844>\
**Category:** Technical Support\
**Tags:** rest-api, metadata-retrieval, grants\
**Created:** [28 July 2022 16:06 UTC](https://community.crossref.org/t/json-schema-for-content-negotiation/2844 "2022-07-28T16:06:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ialarmedalien](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@ialarmedalien](https://community.crossref.org/u/ialarmedalien)\
**Post date:** [28 July 2022 16:06 UTC](https://community.crossref.org/t/json-schema-for-content-negotiation/2844/1 "2022-07-28T16:06:11Z")

</div>

I’m currently retrieving CrossRef and DataCite metadata from doi org using content negotiation, as documented in the DOI content negotiation guide.

A couple of questions:

- Is it possible to get the output from the REST API using content negotiation at doi org? The main advantage of using content negotiation is that I don’t have to do a preliminary test to see whether the doi I’m fetching the metadata for is registered with CrossRef or with DataCite.

- I would like to see the schema used for the citeproc JSON output so I can write a generic parser. It doesn’t seem to be the schema used by the REST API; can you point me to the appropriate documentation?

Thanks!

---

<div class="post-metadata">

**Author:** ![ialarmedalien](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@ialarmedalien](https://community.crossref.org/u/ialarmedalien)\
**Post date:** [28 July 2022 18:42 UTC](https://community.crossref.org/t/json-schema-for-content-negotiation/2844/2 "2022-07-28T18:42:08Z")

</div>

From further searching of documentation, gitlab, etc., it appears that the REST API does serve the JSON response when using content negotiation. However, the models documented in the swagger docs (at api\_crossref\_org/swagger-ui/index.html) don’t correspond to the data returned by the API. E.g. the `works/{doi}` endpoint returns content with `award` and `project` keys in the object under the `message` key, but those keys don’t exist in the `Works` model that you get if you click on the “Model” link in the example response.

Are the correct models available somewhere?

---

<div class="post-metadata">

**Author:** ![ifarley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.crossref.org/ifarley/32/44_2.png) [@ifarley](https://community.crossref.org/u/ifarley)\
**Post date:** [29 July 2022 02:41 UTC](https://community.crossref.org/t/json-schema-for-content-negotiation/2844/4 "2022-07-29T02:41:15Z")

</div>

Hi @ialarmedalien ,

Thanks for your questions, and welcome to the community forum.

Information on the `award` filter should be available to you in the swagger documentation. Do you see it here: [Swagger UI](https://api.crossref.org/swagger-ui/index.html#/Funders/get_funders)

 ![Screen Shot 2022-07-28 at 9.33.59 PM](https://us1.discourse-cdn.com/flex020/uploads/crossref/original/1X/2a39f83b20b9d436f501e8271bc0c16ac94ff1ea.jpeg)

Do you have an example of project that you could provide so I can take a closer look?

We do not have a JSON output schema, although the Swagger documentation is thorough. I can say that the JSON output does map to our input schema: [Schema documentation for crossref5.3.1.xsd](https://data.crossref.org/reports/help/schema_doc/5.3.1/index.html)

I’ve also noted your request for a JSON output schema in the JIRA issue we’re using to prioritize this potential, future work: [[CR-529] - Jira](https://crossref.atlassian.net/browse/CR-529).

Looking forward to hearing back from you,  
Isaac

---

<div class="post-metadata">

**Author:** ![ifarley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.crossref.org/ifarley/32/44_2.png) [@ifarley](https://community.crossref.org/u/ifarley)\
**Post date:** [29 July 2022 13:14 UTC](https://community.crossref.org/t/json-schema-for-content-negotiation/2844/5 "2022-07-29T13:14:42Z")

</div>

After talking with others on the support team, we believe you might be asking about a grants example, like this one: [https://api.crossref.org/works/10.46936/cpcy.proj.2019.50733/60006578](https://api.crossref.org/works/10.46936/cpcy.proj.2019.50733/60006578)

`message`, `award`, and `project` are all present in this output.

This documentation - the grants markup guide - should be helpful: [Grants markup guide - Crossref](https://www.crossref.org/documentation/schema-library/markup-guide-record-types/grants/)

Take a look and let me know if you have follow-up questions,  
Isaac

---

<div class="post-metadata">

**Author:** ![ialarmedalien](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@ialarmedalien](https://community.crossref.org/u/ialarmedalien)\
**Post date:** [29 July 2022 15:22 UTC](https://community.crossref.org/t/json-schema-for-content-negotiation/2844/6 "2022-07-29T15:22:46Z")

</div>

Hi @ifarley and thanks for the quick responses!

> After talking with others on the support team, we believe you might be asking about a grants example, like this one: https //api crossref org/works/10.46936/cpcy.proj.2019.50733/60006578

The example you’ve given here is similar to what I’ve been looking at – a DOI representing a grant.  
The data structure under `message` has keys including `award` (value: “50733”) and `project` (value: nested data structure that includes `project-title` and `funding`).

The documentation of the `/works/{doi}` endpoint has an example 200 response and the model ( **WorkMessage** ) for that response, with the value of the `message` key given as a `Work` model. If you expand the `Work` model to see the keys/values beneath it, neither the `award` key nor the `project` key exist, and several of the starred (presumably required) fields do not exist in the object under the `message` key from the API URL you provided.

I am writing a parser for the CrossRef API to map the output to my local schema. I have a list of DOIs to look up, and I won’t know in advance whether they represent grants, datasets, journal articles, etc., etc. I need to know what data structures the endpoint outputs so I can extract the appropriate information from the API response. If I build a parser that assumes that the output of the `/works/{doi}` endpoint is always structured as a **Work** , as documented at `api crossref org/swagger-ui/index.html#model-Work`, I’ll obviously miss all the funding info.

Thus my question is: how can a parser know, without human intervention, what schema the REST API output from `/works/{doi}` is using?
