# FAIRsharing Data Access

### REST

A REST API is available which permits querying, creating and updating records in FAIRsharing. In order to use it an account is required; if you have signed in using a service such as ORCID you'll need to create a password and authenticate to the API via your FAIRsharing username/password.&#x20;

The terms of use of the REST API can be found [here](https://fairsharing.org/licence). Currently, documentation is available [on the main FAIRsharing site](https://fairsharing.org/API_doc), though we may also add some here at a later date.&#x20;

### GraphQL

This API is currently under development. If you're interested in using it then please [contact us](mailto:contact@fairsharing.org) for a key.&#x20;

### OAI-PMH

There's an OAI-PMH endpoint available at <https://api.fairsharing.org/oai>. This is currently a work in progress and further fields may be added to the output later. Here are some example queries:\
\
List records:&#x20;

{% embed url="<https://api.fairsharing.org/oai?verb=ListRecords&metadataPrefix=oai_dc>" %}

Display a single record:

{% embed url="<https://api.fairsharing.org/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:fairsharing_record:2521>" %}

### Content negotiation and signposting

In addition to the REST API above, it's possible to request information directly from our site in machine-readable format, without using <https://api.fairsharing.org>. If a request for the headers of a page is made the information will be embeded there showing what links/data formats are available. For example:

```
curl -X HEAD -I https://fairsharing.org/FAIRsharing.2abjs5
```

...will return the following links in its header information:

```
link: <https://doi.org/10.25504/FAIRsharing.2abjs5>; rel="cite-as"
link: <https://fairsharing.org/FAIRsharing.2abjs5>; rel="describedby"; type="application/ld+json"
link: <https://fairsharing.org/FAIRsharing.2abjs5>; rel="describedby"; type="application/json"
link: <https://api.fairsharing.org/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:fairsharing_record:FAIRsharing.2abjs5>; rel="describedby"; type="text/xml"
link: <https://fairsharing.org/FAIRsharing.2abjs5>; rel="describedby"; type="text/turtle; profile="http://www.w3.org/ns/dcat#""
```

The first of these links shows how to cite the record. The second two describe how to obtain information about the record in either JSON or JSON+LD format. The first of these formats will contain the record's entire metadata field.

To access data in one of these formats the following command can be used:

```
curl -X GET -H "Accept: application/json" https://fairsharing.org/FAIRsharing.2abjs5 
```

This feature doesn't offer any means to search or modify records, but could be useful for anyone needing to quickly access machine-readable data from our website's pages.&#x20;

As with our API, the licence terms for the use of our data are included in the response (<https://creativecommons.org/licenses/by-sa/4.0/>).

### Additional Information

You can find more out about signposting in this EOSC report:

Wilkinson, M., Sansone, S.-A., Grootveld, M., Dennis, R., Hecker, D., Huber, R., Soiland-Reyes, S., Van de Sompel, H., Czerniak, A., Thurston, M., Lister, A., & Gaignard, A. (2024). **Report on FAIR Signposting and its Uptake by the Community. Zenodo.** <https://doi.org/10.5281/zenodo.10490289>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fairsharing.gitbook.io/fairsharing/programmatic-access/fairsharing-rest-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
