Semantic Layer APIs
Update a semantic layer
Change or clear the descriptions, synonyms and column types of a datamart.
Only the fields you send change. Everything else stays.
curl --request PUT https://api.usedatabrain.com/api/v2/data-app/datamarts/semantic-layer \ --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "datamartName": "Sales", "tables": [ { "name": "orders", "synonyms": [], "columns": [{ "name": "amount", "description": "Order total in USD, after discounts." }] } ] }'Auth
A service token only. See Authentication.
ServiceTokenAuthorizationBearer <token>A service token. A data app API token is refused.
Body
The fields, limits and column types are the same as Create a semantic layer. Send datamartName and at least one of tables or feedback.
| You send | It does |
|---|---|
| A field with a value | Replaces that field |
A field as null or "" | Clears it |
synonyms: [] | Clears the synonyms |
feedback | Replaces the note. null or "" removes it |
| A field left out | Keeps it |
tables: [] or columns: [] | Changes nothing |
The datamart.
Send this or the other one of the pair. Text per table.
6 fields in tables
A table of the datamart.
Limit: 10 items, 100 characters each, no duplicates. Other words for the table.
10Text per column.
8 fields in columns
A column of that table.
Limit: 10 items, 100 characters each, no duplicates. Other words for the column.
10Limit: See below. The kind of value.
StringLong StringString (Custom)ENUMMapperRangeExpressionIdentifierNumberJSONLimit: See below. Values for the column type. Send columnType with it.
The column identifies a row.
Do not give this column's ENUM values to Bryn.
Accepted and ignored. Tables are matched by name.
Send this or the other one of the pair. Limit: 2,000 characters. A note on the whole datamart.
2000Response
{ "id": "Sales" }Errors
The errors are the same as on create, but instead of SEMANTIC_LAYER_ALREADY_EXISTS:
| Status | error.code | Why |
|---|---|---|
| 404 | SEMANTIC_LAYER_NOT_FOUND | No semantic layer found for datamart '<name>'. Use POST to create first. |
For errors that every endpoint returns, see Authentication.
curl -X PUT 'https://api.usedatabrain.com/api/v2/data-app/datamarts/semantic-layer' \ -H 'Content-Type: application/json' \ -d '{ "datamartName": "Sales", "tables": [ { "name": "orders", "synonyms": [], "columns": [ { "name": "amount", "description": "Order total in USD, after discounts." } ] } ]}'{ "id": "Sales"}