PATCH /v1/dataQuality/testCases/{id}
from metadata.sdk import configure
from metadata.sdk.entities import TestCases
configure(
host="https://your-company.getcollate.io/api",
jwt_token="your-jwt-token"
)
# Retrieve, modify, and update
tc = TestCases.retrieve("c1bce355-fa2f-48c6-ab4d-fad722a56ed7")
tc.description = "Updated: Validates shop_id max value stays between 1 and 200"
tc.parameterValues = [
{"name": "minValueForMaxInCol", "value": "1"},
{"name": "maxValueForMaxInCol", "value": "200"}
]
updated = TestCases.update(tc)
print(f"Updated to version {updated.version.root}")
// client is an initialized OpenMetadataClient.
var testCaseId = "c1bce355-fa2f-48c6-ab4d-fad722a56ed7";
var testCase = client.testCases().get(testCaseId);
testCase.setDescription("Updated: Validates shop_id max value stays between 1 and 200");
var updated = client.testCases().update(testCaseId, testCase);
# Update by ID
curl -X PATCH "{base_url}/api/v1/dataQuality/testCases/c1bce355-fa2f-48c6-ab4d-fad722a56ed7" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Validates shop_id max value stays between 1 and 200"},
{"op": "replace", "path": "/parameterValues", "value": [{"name": "minValueForMaxInCol", "value": "1"}, {"name": "maxValueForMaxInCol", "value": "200"}]}
]'
# Update by name
curl -X PATCH "{base_url}/api/v1/dataQuality/testCases/name/sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated description"}
]'
{
"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": "Updated: Validates shop_id max value stays between 1 and 200",
"version": 0.2,
"updatedAt": 1769982800000,
"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": "200"}
],
"deleted": false,
"owners": []
}
Update a Test Case
Update test case properties using JSON Patch operations (add, remove, replace) to modify metadata fields like description, owners, and configuration via the Collate REST API.
PATCH
/
v1
/
dataQuality
/
testCases
/
{id}
PATCH /v1/dataQuality/testCases/{id}
from metadata.sdk import configure
from metadata.sdk.entities import TestCases
configure(
host="https://your-company.getcollate.io/api",
jwt_token="your-jwt-token"
)
# Retrieve, modify, and update
tc = TestCases.retrieve("c1bce355-fa2f-48c6-ab4d-fad722a56ed7")
tc.description = "Updated: Validates shop_id max value stays between 1 and 200"
tc.parameterValues = [
{"name": "minValueForMaxInCol", "value": "1"},
{"name": "maxValueForMaxInCol", "value": "200"}
]
updated = TestCases.update(tc)
print(f"Updated to version {updated.version.root}")
// client is an initialized OpenMetadataClient.
var testCaseId = "c1bce355-fa2f-48c6-ab4d-fad722a56ed7";
var testCase = client.testCases().get(testCaseId);
testCase.setDescription("Updated: Validates shop_id max value stays between 1 and 200");
var updated = client.testCases().update(testCaseId, testCase);
# Update by ID
curl -X PATCH "{base_url}/api/v1/dataQuality/testCases/c1bce355-fa2f-48c6-ab4d-fad722a56ed7" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Validates shop_id max value stays between 1 and 200"},
{"op": "replace", "path": "/parameterValues", "value": [{"name": "minValueForMaxInCol", "value": "1"}, {"name": "maxValueForMaxInCol", "value": "200"}]}
]'
# Update by name
curl -X PATCH "{base_url}/api/v1/dataQuality/testCases/name/sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated description"}
]'
{
"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": "Updated: Validates shop_id max value stays between 1 and 200",
"version": 0.2,
"updatedAt": 1769982800000,
"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": "200"}
],
"deleted": false,
"owners": []
}
Update a Test Case
Update a test case’s properties using JSON Merge Patch. You can update by ID or by fully qualified name.Update by ID
Update by Name
UsePATCH /v1/dataQuality/testCases/name/{fqn} to update by fully qualified name.
Body Parameters
Send a JSON object with the fields to update. Only provided fields are changed.PATCH /v1/dataQuality/testCases/{id}
from metadata.sdk import configure
from metadata.sdk.entities import TestCases
configure(
host="https://your-company.getcollate.io/api",
jwt_token="your-jwt-token"
)
# Retrieve, modify, and update
tc = TestCases.retrieve("c1bce355-fa2f-48c6-ab4d-fad722a56ed7")
tc.description = "Updated: Validates shop_id max value stays between 1 and 200"
tc.parameterValues = [
{"name": "minValueForMaxInCol", "value": "1"},
{"name": "maxValueForMaxInCol", "value": "200"}
]
updated = TestCases.update(tc)
print(f"Updated to version {updated.version.root}")
// client is an initialized OpenMetadataClient.
var testCaseId = "c1bce355-fa2f-48c6-ab4d-fad722a56ed7";
var testCase = client.testCases().get(testCaseId);
testCase.setDescription("Updated: Validates shop_id max value stays between 1 and 200");
var updated = client.testCases().update(testCaseId, testCase);
# Update by ID
curl -X PATCH "{base_url}/api/v1/dataQuality/testCases/c1bce355-fa2f-48c6-ab4d-fad722a56ed7" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Validates shop_id max value stays between 1 and 200"},
{"op": "replace", "path": "/parameterValues", "value": [{"name": "minValueForMaxInCol", "value": "1"}, {"name": "maxValueForMaxInCol", "value": "200"}]}
]'
# Update by name
curl -X PATCH "{base_url}/api/v1/dataQuality/testCases/name/sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated description"}
]'
{
"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": "Updated: Validates shop_id max value stays between 1 and 200",
"version": 0.2,
"updatedAt": 1769982800000,
"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": "200"}
],
"deleted": false,
"owners": []
}
Returns
Returns the updated test case object with the new version number.Response
Error Handling
| Code | Error Type | Description |
|---|---|---|
400 | BAD_REQUEST | Invalid JSON patch or malformed request |
401 | UNAUTHORIZED | Invalid or missing authentication token |
403 | FORBIDDEN | User lacks permission to update this test case |
404 | NOT_FOUND | Test case with given ID or FQN does not exist |
409 | CONFLICT | Concurrent modification detected |
Was this page helpful?