Getting Started

The Datablist REST API is exposed at https://data.datablist.com. You must always connect to the API using HTTPS.

Our API has resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, uses standard HTTP response codes, and verbs.

Authentication#

Every api endpoint requires an Authorization header with an access token. We use self contained JWT access tokens sent using the Bearer format.

A valid API call looks like this:

$ curl https://data.datablist.com/{{endpoint}} \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

Because our access token are self contained, they can be decoded to retrieve important information like user id, scope or expiration.

More information on JWT.io.

info

Our access tokens expire after 24h and must be refreshed.

Get Access Token from Personal API Key#

Personal API Keys let you generate access tokens. To create a Personal API Key, go to the API page in your Datablist account.

To get an access token, you must call the token endpoint on https://account.datablist.com.

$ curl https://account.datablist.com/token \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"apiKey": "{{your Personal API Key}}"}'

If your Personal API Key is valid, the response will be:

Response token endpont
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.LKDSLFKASLDFKLASDFLKyMTQzNjcsImFjY291bnQiOiJjOGQ5MDZiN2RkNjI0MThkYTNlNDJkYWVmMDlkMDJhZCIsInNjb3BlIjoiYWRtaW4ifQ.SDKFLSDFKAOSDKLFKXCLV",
"token_type": "Bearer",
"expires_in": 172800,
"expires_at": 1679214367,
"account_id": "SLKFLSDKFLASOJIWEJ",
"user_id": "auth0|9283494JDFKSDSD4",
"scope": [
"admin"
]
}

Then use, the access_token as Bearer for your calls.

Requests and Responses format#

The only accepted content types are JSON and JSON-LD. Requests must use the Accept: application/json or Accept: application/ld+json (what format you want to receive) and Content-Type: application/json or Content-Type: application/ld+json (what content format are you sending in) headers.

Responses from Datablist are returned in json with the Content-Type: application/json or Content-Type: application/ld+json header according to the Accept header.

Requests#

A request with a body looks like:

$ curl https://data.datablist.com/{{endpoint}} \
-X POST \
-H "Authorization: Bearer {{ACCESS_TOKEN}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"field1":"value1", "field2":"value2"}'

Responses#

Response for resource detail
{
"@context": {...},
"@id": "{{ALPHANUMERIC_STRING}}",
"@type": "Workspace|Collection|Item",
"createdAt": "2020-07-08T09:31:10.303945",
"updatedAt": "2020-07-08T09:31:10.303945",
...
}
Response for listing
{
"@context": {...},
"data": [{
"@id": "{{ALPHANUMERIC_STRING}}",
"@type": "Workspace|Collection|Item",
"createdAt": "2020-07-08T09:31:10.303945",
"updatedAt": "2020-07-08T09:31:10.303945",
...
},{
"@id": "{{ALPHANUMERIC_STRING}}",
"@type": "Space|Collection|Item",
"createdAt": "2020-07-08T09:31:10.303945",
"updatedAt": "2020-07-08T09:31:10.303945",
...
}]
}

HTTP Status Codes#

We use HTTP Status Codes to inform on response status. Any code between 200 (included) and 300 (excluded) indicates the request has been successfully processed. Other codes indicate an error.

HTTP Status CodeDescription
200Success.
201Created object success.
204Success with empty response. This is used for update (PUT, PATCH) and delete requests.
400Bad Request
401Unauthorized. Access Token is missing or invalid.
404The resource could not be found.
405Method Not Allowed for this endpoint.
500Unexpected server error ๐Ÿค–.

Error Responses#

On error, a json response is returned with a HTTP status code and the following attributes:

AttributeDescription
http_statusDuplicate of the HTTP status code.
codeA short string indicating the error reported.
descriptionHuman readable description of the error.
Example of error response
{
"http_status": 404,
"code": "NotFound",
"description": "Requested URL /a_random_path not found"
}

Get, List, Create, Update, Delete - Single operation or bulk#

Datablist uses HTTP verbs for CRUD operations:

HTTP VerbDescriptionReturn
POSTCreate an objectReturn HTTP status 201 with a {"@id": "object_id"} response and a Location header pointing to the newly created resource
GETRetrieve object(s)Return HTTP status 200.
PATHPartial UpdateReturn HTTP status 204 (empty response)
PUTFull UpdateReturn HTTP status 204 (empty response)
DELETEDelete objectReturn HTTP status 204 (empty response)

Create#

The createdAt and @id value can be set on a POST request. If not provided, they will be auto generated. If an object already exist with the same @id, an error will be raised (http_status 400 and IntegrityError code).

Success response has a 201 status with the resource URI in the Location http header.

Update#

updatedAt is updated on any PUT or PATCH request. Success response returns a 204 status with an empty body.

Bulk#

Item endpoints accept bulk operations with the {{endpoing}}/bulk path. See documentation.

If you need to perform a high number of operations, we recommend to use both bulk request and parallelization.

Our current benchmarks recommend a maximum of 20 concurrency requests of 200 bulk operations.

Example: To create 10 000 items, you would perform 10000/200=50 requests with a maximum of 20 parallel requests.

Concurrency Example

Filtering#

To filter, add the filter GET param with a list of filtering operators encoded using json.

$ curl https://data.datablist.com/{{endpoint}}?filter=[{"name":"FIELD_NAME","op":"OPERATOR","val": "VALUE"}]

Valid operators are:

  • eq: Equals
  • array_contains: Array Contains
  • in: In
  • not-in: Not In
  • ge: Greater Than or Equal

Futur operators (not implemented):

  • ne: Not Equals
  • gt: Greater Than
  • lt: Less Than
  • l: Less Than or Equal

Ordering#

Use the order_by GET param and the name of the field to order results. Use - for descending.

Example:

$ curl https://data.datablist.com/{{endpoint}}?order_by=FIELD_NAME

or descending:

$ curl https://data.datablist.com/{{endpoint}}?order_by=-FIELD_NAME

FAQ#

  • Do you have API versioning? - You might notice we don't have versioning prefix on our API endpoints. We are guided with the Linked Data principles that requires that a resource object has one and only one URI. This is not compatible with versioning as part of the URI. The API is currently in Alpha and is likely to change in the coming months. Later, we will introduce versioning using headers.