Skip to content
Last updated

Update an Insights Model Relation

You cannot use PUT or PATCH to modify an Insights model relation. Instead, delete the existing relation and recreate it with the updated definition.

For example, suppose data model A currently relates table1 and table2 on the id column. After retrieving the relation ID (see Get a List of Data Model Relations), you can add table3 to the relation by:

  1. Deleting the existing relation.
  2. Creating a new relation that includes all three tables.

For the API endpoint, select the appropriate endpoint for your region.

curl -X DELETE https://<api endpoint>/reporting/datamodels/xxxxxx/relations/yyyyyy \
-H 'authorization: TD1 xxxx/xxxxxxxxxxxxxx' \
-H 'accept: application/json'
curl -v -X POST https://<api endpoint>/reporting/datamodels/xxxxxx/relations \
-H 'authorization: TD1 xxxx/xxxxxxxxxxxxxx' \
-H 'cache-control: no-cache' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-d '{
  "definition": [
    {"dataset": "ds1", "table": "table1", "column": "name"},
    {"dataset": "ds1", "table": "table2", "column": "name"},
    {"dataset": "ds2", "table": "table3", "column": "name"}
  ]
}'