Skip to content
Francisco Yedro edited this page Jan 20, 2020 · 8 revisions

Documentation for developers of the TheyBuyForYou API

The TheyBuyForYou API is built to allow you to obtain public procurement data from the TheyBuyForYou project knowledge graph.

The API is organised around REST. All API calls should be made to the http://tbfy.librairy.linkeddata.es/kg-api/ base domain. A JSON file will be returned in all responses from the API. The API allows you 27 different resources organised in 5 main groups:

Query parameters

Paginated Query

The API allows you to make paginated queries by simply adding the query param size and offset since they are special variables.

To show a list with only 5 organisations, it will be enough to request it this way: GET /organisation?size=5

and if the next page is needed, it is enough using: GET /organisation?size=5&offset=1

When considering paginated queries it is necessary to set the ORDER option in the Sparql query.

Sort Criteria

The sort query param establishes the order of a solution sequence.

It contains a field name and an order modifier (either + or -). Each ordering comparator is either ascending (indicated by the + modifier or by no modifier) or descending (indicated by the -` modifier).

Internally, R4R adds an ORDER BY clause to the SPARQL query with the closest property (by using the Levenhstein distance) to the one specified in the sort field.

Now you can make requests like this: GET /organisation?sort=-name

Filters

The API allows filtering in some fields of the resources that return lists such as name, title, description or status. The way in which a list can be filtered is by adding ?<name of the field to be filtered>=xxx in the case of text fields. Example:

We need to obtain the list of tenders that contain the word "cluster": GET /tender?title=cluster

Documentation of the core-API

Resources

Return to Home

Clone this wiki locally