Skip to main content
POST
https://sandbox.getcollate.io/api
/
v1
/
dataQuality
/
testCases
POST /v1/dataQuality/testCases
from metadata.sdk import configure
from metadata.sdk.entities import TestCases
from metadata.generated.schema.api.tests.createTestCase import CreateTestCaseRequest

configure(
    host="https://your-company.getcollate.io/api",
    jwt_token="your-jwt-token"
)

# Create a column-level test case
request = CreateTestCaseRequest(
    name="column_value_max_to_be_between",
    testDefinition="columnValueMaxToBeBetween",
    testSuite="b5fcae09-02c2-4c0b-8c4a-5b52d650e592",
    entityLink="<#E::table::sample_data.ecommerce_db.shopify.dim_address::columns::shop_id>",
    parameterValues=[
        {"name": "minValueForMaxInCol", "value": "1"},
        {"name": "maxValueForMaxInCol", "value": "100"}
    ],
    description="Validates shop_id max value stays between 1 and 100"
)

test_case = TestCases.create(request)
print(f"Created: {test_case.fullyQualifiedName}")
{
  "id": "c1bce355-fa2f-48c6-ab4d-fad722a56ed7",
  "name": "column_value_max_to_be_between",
  "fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between",
  "description": "Validates shop_id max value stays between 1 and 100",
  "version": 0.1,
  "updatedAt": 1769982759035,
  "updatedBy": "admin",
  "testDefinition": {
    "id": "def-id",
    "type": "testDefinition",
    "name": "columnValueMaxToBeBetween",
    "fullyQualifiedName": "columnValueMaxToBeBetween",
    "deleted": false
  },
  "testSuite": {
    "id": "suite-id",
    "type": "testSuite",
    "name": "b5fcae09-02c2-4c0b-8c4a-5b52d650e592",
    "deleted": false
  },
  "entityLink": "<#E::table::sample_data.ecommerce_db.shopify.dim_address::columns::shop_id>",
  "parameterValues": [
    {"name": "minValueForMaxInCol", "value": "1"},
    {"name": "maxValueForMaxInCol", "value": "100"}
  ],
  "deleted": false,
  "owners": []
}

Create a Test Case

Create a new test case by linking a test definition to a specific table or column with concrete parameter values.

Body Parameters

name
string
required
Name of the test case. Must be unique within the target entity scope.
testDefinition
string
required
Fully qualified name of the test definition to use (e.g., columnValueMaxToBeBetween).
testSuite
string
required
Fully qualified name of the test suite this test case belongs to.
Entity link to the target table or column. Format: <#E::table::tableFQN> for table-level or <#E::table::tableFQN::columns::colName> for column-level.
parameterValues
array
Array of parameter name/value pairs as defined by the test definition.
description
string
Description of the test case in Markdown format.
owners
array
Array of owner references (users or teams) to assign.
POST /v1/dataQuality/testCases
from metadata.sdk import configure
from metadata.sdk.entities import TestCases
from metadata.generated.schema.api.tests.createTestCase import CreateTestCaseRequest

configure(
    host="https://your-company.getcollate.io/api",
    jwt_token="your-jwt-token"
)

# Create a column-level test case
request = CreateTestCaseRequest(
    name="column_value_max_to_be_between",
    testDefinition="columnValueMaxToBeBetween",
    testSuite="b5fcae09-02c2-4c0b-8c4a-5b52d650e592",
    entityLink="<#E::table::sample_data.ecommerce_db.shopify.dim_address::columns::shop_id>",
    parameterValues=[
        {"name": "minValueForMaxInCol", "value": "1"},
        {"name": "maxValueForMaxInCol", "value": "100"}
    ],
    description="Validates shop_id max value stays between 1 and 100"
)

test_case = TestCases.create(request)
print(f"Created: {test_case.fullyQualifiedName}")
{
  "id": "c1bce355-fa2f-48c6-ab4d-fad722a56ed7",
  "name": "column_value_max_to_be_between",
  "fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between",
  "description": "Validates shop_id max value stays between 1 and 100",
  "version": 0.1,
  "updatedAt": 1769982759035,
  "updatedBy": "admin",
  "testDefinition": {
    "id": "def-id",
    "type": "testDefinition",
    "name": "columnValueMaxToBeBetween",
    "fullyQualifiedName": "columnValueMaxToBeBetween",
    "deleted": false
  },
  "testSuite": {
    "id": "suite-id",
    "type": "testSuite",
    "name": "b5fcae09-02c2-4c0b-8c4a-5b52d650e592",
    "deleted": false
  },
  "entityLink": "<#E::table::sample_data.ecommerce_db.shopify.dim_address::columns::shop_id>",
  "parameterValues": [
    {"name": "minValueForMaxInCol", "value": "1"},
    {"name": "maxValueForMaxInCol", "value": "100"}
  ],
  "deleted": false,
  "owners": []
}

Returns

Returns the created test case object with all specified properties and system-generated fields.

Response

id
string
Unique identifier for the test case (UUID format).
name
string
Test case name.
fullyQualifiedName
string
Fully qualified name in format table.column.testCaseName or table.testCaseName.
description
string
Description of the test case.
testDefinition
object
Reference to the test definition.
testSuite
object
Reference to the test suite.
Entity link to the target table or column.
parameterValues
array
Parameter values for this test case.
owners
array
List of owners assigned to the test case.
version
number
Version number for the entity (starts at 0.1).

Create or Update (PUT)

Use PUT /v1/dataQuality/testCases instead of POST to perform an upsert. If a test case with the same fullyQualifiedName already exists, it will be updated; otherwise, a new test case is created. The request body is the same as POST.
curl -X PUT "{base_url}/api/v1/dataQuality/testCases" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{ ... same body as POST ... }'
PUT will not return a 409 conflict error if the entity already exists — it will update the existing entity instead.

Error Handling

CodeError TypeDescription
400BAD_REQUESTInvalid request body or missing required fields
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENUser lacks permission to create test cases
409ENTITY_ALREADY_EXISTSTest case with same name already exists for this entity (POST only)