Skip to Content

Semantic Layer APIs

Update a semantic layer

Change or clear the descriptions, synonyms and column types of a datamart.

PUT
/api/v2/data-app/datamarts/semantic-layer

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.

Authorization

ServiceToken
headerAuthorizationBearer <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 sendIt does
A field with a valueReplaces that field
A field as null or ""Clears it
synonyms: []Clears the synonyms
feedbackReplaces the note. null or "" removes it
A field left outKeeps it
tables: [] or columns: []Changes nothing
datamartNamestringrequired

The datamart.

tablesobject[]

Send this or the other one of the pair. Text per table.

6 fields in tables
namestringrequired

A table of the datamart.

descriptionstring | null

Limit: 500 characters. What the table holds.

Max length: 500
synonymsstring[]

Limit: 10 items, 100 characters each, no duplicates. Other words for the table.

Max items: 10
miscellaneousInfostring | null

Limit: 1,000 characters. Other notes.

Max length: 1000
columnsobject[]

Text per column.

8 fields in columns
namestringrequired

A column of that table.

descriptionstring | null

Limit: 500 characters. What the column holds.

Max length: 500
synonymsstring[]

Limit: 10 items, 100 characters each, no duplicates. Other words for the column.

Max items: 10
miscellaneousInfostring | null

Limit: 1,000 characters. Other notes.

Max length: 1000

Limit: See below. The kind of value.

One of: StringLong StringString (Custom)ENUMMapperRangeExpressionIdentifierNumberJSON

Limit: 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.

schemaNamestring | null

Accepted and ignored. Tables are matched by name.

feedbackstring

Send this or the other one of the pair. Limit: 2,000 characters. A note on the whole datamart.

Max length: 2000

Response

{ "id": "Sales" }

Errors

The errors are the same as on create, but instead of SEMANTIC_LAYER_ALREADY_EXISTS:

Statuserror.codeWhy
404SEMANTIC_LAYER_NOT_FOUNDNo semantic layer found for datamart '<name>'. Use POST to create first.

For errors that every endpoint returns, see Authentication.

Example Request
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."        }      ]    }  ]}'
Example Response
{  "id": "Sales"}