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:

Last updated