Consuming Datachain API

Summary

  • APIs are datasets designed and shared from the DataChain platform

  • They contain a set of information (metadata) in addition to the dataset

  • All published APIs from DataChain that a user has access to are visible in the Marketplace

  • It is possible to build queries and test APIs from the Marketplace

  • An API key is required to consume APIs outside the Marketplace

Introduction

All APIs available in the DataChain Marketplace come directly from datasets created, managed and shared via the DataChain platform.
This mechanism not only guarantees complete traceability, but also secure and controlled access to data at every stage of its lifecycle, from creation to final consumption within applications.
DataChain thus acts as a centralised and reliable ecosystem, ensuring the integrity and compliance of the information made available, while facilitating the discovery and integration of these APIs by consumers outside DataChain. == Building queries and testing APIs

The Marketplace allows you to build queries and test APIs quickly and easily, then use them outside the DataChain ecosystem.

Within DataChain

You can view metadata and all information related to the API from its detail page.
You can build queries using the form to generate the URL and then preview the results in REST or OData formats.

Outside DataChain

APIs can be used outside DataChain. Whatever API type is used, the API request must be authenticated. The authentication system is described later on this page.

Two API formats are available, whose operation is described on dedicated pages:

Authentication

To access the APIs, you must be authenticated with the server. Two authentication methods can be used:

  • via OAuth Token,

  • via Datachain token,

  • via Kerberos (in this case, you must obtain a Kerberos token, not documented here)

Using an OAuth Token

This token is obtained from your authentication system. The method for obtaining your token should be provided by your SSO administrator.
In the case of Keycloak, it is possible to obtain the token via a request of this type.

curl --location --request POST 'https://'VOTRE_URL_KEYCLOAK'/auth/realms/dc-realm/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=VOTRE_LOGIN' \
--data-urlencode 'password=VOTRE_MOT_DE_PASSE' \
--data-urlencode 'client_id=dc_marketplace' \
--data-urlencode 'client_secret=KEYCLOAK_CLIENT_SECRET' \
--data-urlencode 'scope=openid profile email'

To obtain

{
"access_token": "eyJhbGciOiJS...",
"expires_in": 50400,
"refresh_expires_in": 86400,
"refresh_token": "eyJhbGciO...",
"token_type": "Bearer",
"id_token": "eyJhbGciOiJS...",
"not-before-policy": 0,
"session_state": "e3854203-62ac-45c6-9abc-7bf015401e1d",
"scope": "openid email profile"
}

The contents of the "access_token" field must be placed in the "Authorization: Bearer " header as follows.

curl "https://VOTRE_URL_MARKETPLACE/dmp-api/data/..." -H 'Accept:application/json, text/plain' -H 'Authorization: Bearer eyJhbGciOiJS...'

Using a Datachain Token

Depending on your rights in the Datachain management console, you can generate a token on the console’s “My account” page or request this token from a Datachain console administrator. See the user account management page to learn more.

The token value must be included in the request, in a "DC-X-API-TOKEN" header.

curl "https://VOTRE_URL_MARKETPLACE/dmp-api/data/..." -H 'Accept:application/json, text/plain' -H 'DC-X-API-TOKEN: <VOTRE TOKEN>'

Dernière mise à jour le 9 décembre 2025 à 18:26