Datasource APIs
Sync a datasource
Read the datasource schema again so new tables and columns show up in Databrain.
POST
Run it after you add tables or columns in your warehouse. For most types the call waits until the sync is done. For Amazon S3 it returns at once and you poll the sync status.
curl --request POST https://api.usedatabrain.com/api/v2/datasource/sync \ --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.
Limits
10 requests in 5 minutes per organization, shared with create, update and schema discovery. A large warehouse can take minutes; set a long HTTP timeout.
ApiTokenheader
AuthorizationBearer <token>A service token or a data app API token.
Body
Holds datasourceId.
1 field in input
Response
The sync is done:
{ "data": { "message": "Sync completed" } }Amazon S3, the sync started:
{ "message": "AWSS3 sync started..., please check the status on /api/v2/datasource/getDatasourceProgress" }The sync failed. The status is still 200:
{ "data": { "error": "Schema sync already active" } }Errors
This endpoint has its own error shape:
{ "data": { "error": { "code": "INVALID_DATASOURCE_ID", "message": "Datasource not found", "status": 404 } } }| Status | code | Why |
|---|---|---|
| 400 | INVALID_DATASOURCE_ID | input.datasourceId is missing or not a UUID |
| 404 | INVALID_DATASOURCE_ID | No datasource in your organization has this id |
| 400 | INVALID_REQUEST_BODY | The sync failed in an unexpected way |
| 429 | Rate limit |
For errors that every endpoint returns, see Authentication.
curl -X POST 'https://api.usedatabrain.com/api/v2/datasource/sync' \ -H 'Content-Type: application/json' \ -d '{ "input": { "datasourceId": "6f1c2b9e-4d3a-4f8e-9b7c-2a1d0e5f6c7b" }}'Example Response
{ "data": { "error": "Schema sync already active" }}