Upserting DSEs

Upsert DSEs

By default we will generate a unique DSE ID for you, so you do not need to provide one. Should you wish to provide your own ID, you can do so by providing an ID property in the DSE object. This could be helpful when your DSEs are hierarchical, and you want to make sure that the ID of the parent is stored in the parent property of the child.

The above request will return a 200 status code if succesful. If one of the dses in the array failed to be created, none of the assets will have been stored.

You can upsert using the following code snippet:

const url = "https://{your_tenant}.dscribedata.com/api/dses";
const authToken = "yholmghj8§hbfg...";

fetch(url, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${authToken}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify([
    {
      id: "4030b7de-104f-4547-8d90-030def80c1cf",
      name: "dse",
      parent: "123",
      dataset_id: "42d5b4ca-7c57-4af7-bb4b-ba6f3d35ecd0",
      description: null,
      assets: ["123"],
      key_constraint: "primary"
      children: [
        {
          id: "4030b7de-104f-4547-8d90-030def80c1cf",
          name: "dse",
          parent, // this will be set to the ID of the parent DSE
          dataset_id: "42d5b4ca-7c57-4af7-bb4b-ba6f3d35ecd0",
          description: null,
          assets: ["123"],
        },
      ],
    },
  ]),
});

This table gives a bit more information about every property you send in the request:

ParameterRequiredDescription

id

No

The ID of the asset to be created. If not provided, one will be generated for you. If provided, we will first try to update the dse before creating.

name

Yes

The name of the DSE to be created.

key_constraint

No

Key constraint used on the database. Accepted values are: primary, foreign and unique

parent

No

The id of the parent DSE if the DSEs are hierarchical.

dataset_id

Yes

The ID of the dataset that holds the specific DSE. The Dataset has to exist on the platform.

description

No

A description that will be shown on the asset in the dScribe platform.

assets

No

IDs of assets that the DSE is linked too.

type

No

Type of column in the source system. Think Float, String, Boolean, ...

children

No

A list of DSEs that will be assigned the ID of the parent DSE.

Last updated