API documentation
  • Getting started
  • Assets
    • Querying Assets
    • Upserting Assets
    • Deleting Assets
  • DSEs
    • Querying DSEs
    • Upserting DSEs
    • Deleting DSEs
  • Relations
    • Creating relations
    • Deleting relations
    • Supported node and relation types
  • API reference
Powered by GitBook
On this page
  1. DSEs

Upserting DSEs

PreviousQuerying DSEsNextDeleting DSEs

Last updated 11 months ago

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:

Parameter
Required
Description

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.

  • Upsert DSEs
  • POSTUpsert dses

Upsert dses

post

Create one or more dses

Authorizations
Body
idstringOptional
namestringRequired
parentstringOptional

use the id of the parent dse if the you want to display the dses hierarchically within dScribe

key_constraintstringOptional

Accepted values are primary, foreign and unique

is_leafbooleanOptional

Convenience property exposed to help you determine if the DSE has a parent

assetsstring[]Optional

Assets the DSE is linked too

dataset_idstringOptional

The dataset id the dse is linked too. If the DSEs are created together with the dataset (via POST /api/assets), it will automatically use the created dataset id

descriptionstringOptional
Responses
200
Successful operation
400
One of the values passed to the API is wrong
500
Internal server error
post
POST /api/dses HTTP/1.1
Host: __tenant__.dscribedata.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 487

[
  {
    "id": "text",
    "name": "text",
    "parent": "text",
    "key_constraint": "text",
    "is_leaf": true,
    "assets": [
      "text"
    ],
    "dataset_id": "text",
    "description": "text",
    "children": [
      {
        "id": "text",
        "name": "text",
        "parent": "text",
        "key_constraint": "text",
        "is_leaf": true,
        "assets": [
          "text"
        ],
        "dataset_id": "text",
        "description": "text",
        "children": [
          {
            "id": "text",
            "name": "text",
            "parent": "text",
            "key_constraint": "text",
            "is_leaf": true,
            "assets": [
              "text"
            ],
            "dataset_id": "text",
            "description": "text",
            "children": "[Circular Reference]"
          }
        ]
      }
    ]
  }
]

No content