Validate Data Model (Asset Repository)

To validate an existing Data Model, you need to know your workspace identifier and the Data Model identifier. The sample code uses a dataModelId of 55 and a workspaceId of 123456. Use the actual ID values of your workspace and Data Model.

When validating data models, you can choose whether you want to validate a data model stored in the Asset Repository (including applying overrides), or whether you want to validate a Data Model JSON document.

Assuming you have stored the Data Model in the Asset Repository and have the id of the asset (modelId), you can validate it using the following call. The Body can optionally contain a Model Override.

API Explorer: /datamodels

Validate a Data Model (Asset Repository)

curl '/api/v1/workspaces/123456/datamodels/55/validate' \
    -X POST \
    -H 'accept: application/json;charset=UTF-8'

The following parameters are the base parameters required to validate a Data Model.

Validate a Data Model Response Attributes

In this example response, the model contained the randText(5,10,30) expression, which is reported as incorrect, because the randText() function takes only two arguments. The validation report contains also the exact position where the problem has been found.

Attributes

  • dataModelId integer

    required

    The Data Model identifier

Response200 OK

{
  "api_version": 1,
  "result": {
    "isValid": false,
    "entities": {
      "user": {
        "isValid": false,
        "report": {
          "message": "Expected 2 arguments, but got 3.",
          "properties": {
            "name": {
              "message": "Expected 2 arguments, but got 3.",
              "start": 16,
              "end": 17
            }
          }
        }
      }
    }
  },
  "request_id": "128fa23b"
}

Validate a Data Model (JSON Document)

To validate an existing Data Model, you need to know your workspace identifier and the Data Model identifier. The sample code uses a dataModelId of 55 and a workspaceId of 123456. Use the actual ID values of your workspace and Data Model.

When validating data models, you can choose whether you want to validate a data model stored in the Asset Repository (including applying overrides), or whether you want to validate a Data Model JSON document.

Similar to the generate endpoint, there is a validate endpoint validating a JSON document with a Data Model. The Body contains the Data Model.

API Explorer: /datamodels

It returns the same structures as the "Validate Data Model (Asset Repository)" endpoint.

Validate a Data Model (Asset Repository)

curl '/api/v1/workspaces/123456/datamodels/validate' \
    -X POST \
    -H 'accept: application/json;charset=UTF-8'