Consuming Datachain REST API
Get the list of Exposures available to the logged-in user
Datachain Marketplace provides a REST API that allows you to obtain the metadata of Exposures (information identical to that presented in the MarketPlace interface).
This API is accessible at the URL:
https://VOTRE_URL_MARKETPLACE/dmp-api/expositions
and returns, in the form of a JSON array, the following information about the Exposures.
[
{
"id": 1001,
"label": "My exposition projet",
"rootCode": "MyProjectRootCode",
"expositions": [
{
"title": "Exposition API - Datablock_exposition",
"details": "Detail",
"keywords": [
"Mot Clé"
],
"id": 1002,
"updateDate": 1760437413237,
"accessPoint": "exposition1",
"dcRestUrl": "http://VOTRE_URL_MARKETPLACE/dmp-api/data/MyProjectRootCode/exposition",
"odataUrl": "http://VOTRE_URL_MARKETPLACE/dmp-api/odata/MyProjectRootCode/exposition?$format=json",
"columns": [
{
"alias": "bool",
"idColumn": false,
"list": false,
"filter": true,
"type": "BOOLEAN"
},
{
"alias": "list_string",
"idColumn": false,
"list": true,
"filter": true,
"type": "STRING"
},
// Others Colonnes
]
},
// Others Expositions
]
},
// Others Projects
]
| Key | Description |
|---|---|
rootCode |
Grouping code for Exposures (project root) |
id |
Unique identifier (not needed) |
expositions |
Array of Exposures associated with the root |
expositions[].accessPoint |
Name of the Exposure, used in the URL |
expositions[].id |
Unique identifier (not needed) |
expositions[].dcRestUrl |
REST API URL |
expositions[].odataUrl |
OData API URL |
expositions[].title |
Name of the Exposure in metadata |
expositions[].details |
Description of the Exposure in metadata |
expositions[].keywords |
Keywords associated in the metadata |
expositions[].columns |
Array of columns |
expositions[].columns[].alias |
Column alias |
expositions[].columns[].description |
Column description |
expositions[].columns[].list |
Indicates whether the column is of list type |
expositions[].columns[].type |
Datachain type (among: STRING, INTEGER, BIG_INTEGER, DECIMAL, BOOLEAN, LONG, DATE) |
expositions[].columns[].filter |
Boolean indicating whether filters can be applied |
Get the data of an Exposure
This API allows you to obtain the data of an Exposure in the form of a list of records, with pagination.
https://VOTRE_URL_MARKETPLACE/dmp-api/data/racine/exposition?select=id,nom&filter=nom=beginsWith=A
Query syntaxes and operators
You must follow the DataChain REST API syntax to build queries and call the APIs.
| Syntax | Description | Required? |
|---|---|---|
http://VOTRE_URL_MARKETPLACE/dmp-api/data/<racine>/<exposition>?hitsPerPage=100&page=1 |
Base access URL |
|
exposition? |
Name of the access point assigned when configuring the API |
|
select= |
Selects the columns to return in the response. |
|
filter= |
Filters based on the defined filter parameters |
|
page= |
Indicates the page returned. By default, page 1 is used |
|
hitsPerPage= |
Indicates the number of rows per page |
|
sort= |
Sort based on defined parameters |
|
& |
Character to add between each query syntax element |
| Operator | Syntax | Accepted types | Example |
|---|---|---|---|
And |
and |
Other operators |
(nom=='DURAND') and (prenom=='Pierre') |
Or |
or |
Other operators |
(nom=='DURAND') or (nom=='DUPONT') |
Equal |
== |
String, Numeric, Boolean, Date |
nom=='mon ami' ou nom==ami |
Not equal |
!= |
String, Numeric, Boolean, Date |
nom!='mon ami' ou nom!=ami |
Greater than |
> or =gt= |
Numeric, Date |
> 10 ou =gt=10 |
Greater than or equal |
>= or =ge= |
Numeric, Date |
>= 10 ou =ge=10 |
Less than |
< or =lt= |
Numeric, Date |
< 10 ou =lt=10 |
Less than or equal |
≤ or =le= |
Numeric, Date |
≤ 10 ou =le=10 |
In list |
=in= |
String, Numeric, Boolean, Date |
=in=(ami,copain) |
Not in list |
=out= or =notIn= |
String, Numeric, Boolean, Date |
=out=(ami,copain) ou =notIn=('mon ami','mon copain') |
Between |
=between= |
Numeric, Date |
=between=(2,5) ou =between=('','') |
Not between |
=notBetween= |
Numeric, Date |
=notBetween=(2,5) ou =notBetween=('','') |
Contains |
=contains= |
string |
=contains=('grenoble') |
Does not contain |
=notContains= |
string |
=notContains=(grenoble') |
Begins with |
=beginsWith= |
string |
=beginsWith=A ou =beginsWith='A B' |
Does not begin with |
=notBeginsWith= |
string |
=NotBeginsWith=A ou =NotBeginsWith='A B' |
Ends with |
=endsWith= |
string |
=endsWith=A ou =endsWith='A B' |
Does not end with |
=notEndsWith= |
string |
=notEndsWith=A ou =notEndsWith='A B' |
Is null / Is not null |
=isNull= |
String, Numeric, Boolean, Date |
Nom=isNull=true ou Nom=isNull=false |
Pagination
For paginated requests, it is necessary to know whether all the data has been received.
The Datachain REST API offers two solutions for this:
-
The counting API: This API can be called before the pagination calls, then used in a processing loop (by performing some calculations)
int count=callCountApi();
// Paginate éléments by 1000
int hitsPerPages=1000;
int page=0;
while (hitsPerPages * page < count)
{
page++; // first APi rest Page is 1
callAndStoreDataApi(page, hitsPerPages);
}
-
dc_has_next header: during a data request, the API systematically returns an HTTP header 'dc_has_next', set to true if there is more data, and false otherwise. This header can be used to loop based on its value.
boolean continueIteration=true;
// Paginate éléments by 1000
int hitsPerPages=1000;
int page=0;
while (continueIteration)
{
page++; // first APi rest Page is 1
continueIteration = callAndStoreDataApiAndReturnDcHasNextHeaderValue(page, hitsPerPages);
}
Note: The API also returns an HTTP header "dc_count", which returns the number of available items matching the request (the value is therefore identical to the Count API call.)
Get a single item from an Exposure
When an Exposure exposes data with a unique identifier (indicated in the Exposure profile, 'Id' column of 'Available columns'), it is possible to retrieve an item with id 'ITEM_ID' by calling the URL: https://VOTRE_URL_MARKETPLACE/dmp-api/data/racine/exposition/items/ITEM_ID
Mapping of Datachain types to JSON types.
| Datachain Type | OData Type |
|---|---|
Booléen / Boolean |
boolean |
Décimal / Decimal |
Number |
Entier / Integer |
Number |
Grand nombre entier / Big Integer |
Number |
Chaîne de caractère / String |
String |
Date / Date |
Date in ISO 8601 format as a String (e.g., "2025-10-15T07:34:13Z") |
Liste(Type) / List(Type) |
Array[Type] |