Data Sources Declarative Interface

Declarative API

Check high-level overview of the Declarative API Interface first. To see the entire API specification, visit API reference .

Manage data sources

Next to an entity interface where user can manage each data source individually, there is also declarative interface allowing all data sources including their physical model to be managed at once. The endpoint is

  • /api/layout/dataSources.

Whenever you upload a new data sources layout with its physical models, all the existing will be completely deleted.

Passwords consideration

Passwords of users in data sources can be stored using declarative interface, but they can’t be retrieved back in any way. There is no support to reuse a password from an existing data source with the same identifier during a replace/update procedure.

Once uploaded a new data sources layout without passwords, previously stored passwords are removed. You can repeat the upload with passwords filled in or update particular data source with password using the entity api.

When uploading a data source layout then both or none of the user and password must be specified.

Examples

First, be aware of your application endpoint. For Helm Chart deployment, it represents the https://<organization-hostname> value. For the All-in-One docker image, the default endpoint is http://localhost:3000.

In the following examples:

  • the endpoint is substituted by $ENDPOINT variable;

Retrieve all data sources

Taking into account the password consideration the output is suitable for backup.

curl -H "Authorization: Bearer YWRtaW46Ym9vdHN0cmFwOmFkbWluMTIz" \
  $ENDPOINT/api/layout/dataSources > data-sources-layout.json

Restore all data sources

Taking into account the password consideration you can use payload previously retrieved from this endpoint.

curl -H "Authorization: Bearer YWRtaW46Ym9vdHN0cmFwOmFkbWluMTIz" \
  -H "Content-Type: application/json" \
  -X PUT \
  $ENDPOINT/api/layout/dataSources -d @data-sources-layout.json

Data source declarative document

The physical model in the example is truncated and the password is replaced by a dummy value.

{
  "dataSources": [
    {
      "id": "pg_local_docker-demo",
      "name": "pg_local_docker-demo",
      "pdm": {
        "tables": [
          {
            "columns": [
              {
                "dataType": "STRING",
                "isPrimaryKey": false,
                "name": "category"
              },
              {
                "dataType": "INT",
                "isPrimaryKey": true,
                "name": "product_id"
              },
              {
                "dataType": "STRING",
                "isPrimaryKey": false,
                "name": "product_name"
              }
            ],
            "id": "products",
            "path": [
              "products"
            ]
          }
        ]
      },
      "schema": "demo",
      "type": "POSTGRESQL",
      "url": "jdbc:postgresql://postgres:5432/tiger",
      "username": "postgres",
      "password": "<password>"
    } 
  ]
}

You can also use data sources layout with an empty physical model.

{
  "dataSources": [
    {
      "id": "pg_local_docker-demo",
      "name": "pg_local_docker-demo",
      "pdm": {
        "tables": []
      },
      "schema": "demo",
      "type": "POSTGRESQL",
      "url": "jdbc:postgresql://postgres:5432/tiger",
      "username": "postgres",
      "password": "<password>"
    }
  ]
}