Datasource APIs
Get the sync status
Poll how far a datasource sync has got, for example an Amazon S3 import.
POST
Call it every few seconds after you start a sync on an Amazon S3 datasource. Large syncs of other types report here too.
curl --request POST https://api.usedatabrain.com/api/v2/datasource/getDatasourceProgress \ --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "input": { "datasourceId": "6f1c2b9e-4d3a-4f8e-9b7c-2a1d0e5f6c7b" } }'Auth
A service token. See Authentication.
ApiTokenheader
AuthorizationBearer <token>A service token or a data app API token.
Body
Holds datasourceId.
1 field in input
The datasource id from List datasources
Response
{ "status": { "progress": "12/40", "error": "" }}| Field | Type | Description |
|---|---|---|
status.progress | string | Done and total, as done/total. 0/-1 means the sync is starting |
status.error | string | Empty while the sync runs. A message when it failed |
The status is cleared about 1 second after a sync finishes and about 5 seconds after it fails. A poll after that returns progress 0/... and an empty error. Keep the last status you read.
status can also have other fields, used by Databrain. Ignore them.
Errors
| Status | Body | Why |
|---|---|---|
| 404 | { "data": { "error": { "code": "INVALID_DATASOURCE_ID", "message": "Datasource not found", "status": 404 } } } | No datasource in your organization has this id |
| 200 | { "progress": "0/...", "error": "something went wrong" } | The status could not be read, for example because the id is not a UUID |
For errors that every endpoint returns, see Authentication.
curl -X POST 'https://api.usedatabrain.com/api/v2/datasource/getDatasourceProgress' \ -H 'Content-Type: application/json' \ -d '{ "input": { "datasourceId": "6f1c2b9e-4d3a-4f8e-9b7c-2a1d0e5f6c7b" }}'Example Response
{ "status": { "progress": "12/40", "error": "" }}