Skip to main content
PUT
https://api.pretectum.io
/
v1
/
businessareas
/
{businessAreaId}
/
schemas
/
{schemaId}
/
datasets
/
{datasetId}
/
dataobjects
/
{dataObjectId}
Update Data Object
curl --request PUT \
  --url https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId} \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "_version": 123,
  "[Field Name]": {}
}
'
The Update Data Object endpoint allows you to modify an existing record in a dataset. You can update specific fields while leaving others unchanged. The API uses optimistic locking via the _version field to prevent concurrent modification conflicts.

Prerequisites

Authentication

Include your access token in the Authorization header.
Pass the token directly without the “Bearer” prefix.
Authorization: your_access_token

Request

Path Parameters

businessAreaId
string
required
The unique identifier of the business area. You can obtain this from the List Business Areas endpoint.
schemaId
string
required
The unique identifier of the schema. You can obtain this from the List Schemas endpoint.
datasetId
string
required
The unique identifier of the dataset. You can obtain this from the List Datasets endpoint.
dataObjectId
string
required
The unique identifier of the data object to update. You can obtain this from the List Data Objects endpoint or from a previous create operation.

Headers

Authorization
string
required
Your access token obtained from the /v1/oauth2/token endpoint. Pass the token directly without the “Bearer” prefix.
Content-Type
string
required
Must be application/json.
Accept
string
default:"application/json"
The response content type. Currently only application/json is supported.

Request Body

_version
integer
required
The current version of the data object. This must match the version currently stored in the system to prevent overwriting concurrent changes. You can get this value from List Data Objects or a previous operation.
[Field Name]
varies
The fields to update. Only include fields you want to change. Field names must match the schema field names exactly. Omitted fields remain unchanged.

Example Requests

curl -X PUT "https://api.pretectum.io/v1/businessareas/20240115103000123a1b2c3d4e5f6789012345678901234/schemas/20240115103000456d1e2f3a4b5c6789012345678901234/datasets/20240925152201042a1b2c3d4e5f6789012345678901234/dataobjects/20240601120000123f1a2b3c4d5e6789012345678901234" \
  -H "Authorization: your_access_token" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "_version": 1,
    "Email": "[email protected]",
    "Phone": "+1 555-999-8888",
    "Status": "Premium"
  }'

Response

A successful update returns a 204 No Content response with no body.

Success Response

HTTP/1.1 204 No Content
The 204 No Content response indicates the update was successful. The data object’s version is automatically incremented.

Error Responses

Status CodeDescription
400 Bad RequestInvalid request body, malformed JSON, or version conflict. If the _version doesn’t match the current version, the update is rejected.
401 UnauthorizedInvalid or expired access token. Obtain a new token from /v1/oauth2/token and try again.
403 ForbiddenYour application client does not have permission to update data objects. Contact your tenant administrator.
404 Not FoundThe specified business area, schema, dataset, or data object does not exist, or you do not have access to it.
500 Internal Server ErrorAn unexpected error occurred on the server. Try again later or contact support.

Optimistic Locking

The API uses optimistic locking to prevent concurrent modification conflicts:
  1. When you read a data object, note its _version value.
  2. Include this _version in your update request.
  3. If another process updated the object between your read and update, the versions won’t match and your update is rejected.
  4. On version conflict, re-read the data object to get the latest version and retry your update.
async function updateWithRetry(businessAreaId, schemaId, datasetId, dataObjectId, updates, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      // Get current version
      const dataObjects = await getDataObjects(businessAreaId, schemaId, datasetId);
      const current = dataObjects.items.find(obj => obj._dataObjectId === dataObjectId);

      if (!current) {
        throw new Error('Data object not found');
      }

      // Attempt update with current version
      const success = await updateDataObject(
        businessAreaId,
        schemaId,
        datasetId,
        dataObjectId,
        { ...updates, _version: current._version }
      );

      if (success) {
        return true;
      }
    } catch (error) {
      if (attempt === maxRetries - 1) {
        throw error;
      }
      // Wait before retry
      await new Promise(resolve => setTimeout(resolve, 1000));
    }
  }
  return false;
}

Partial Updates

You only need to include the fields you want to change. Omitted fields retain their current values:
{
  "_version": 1,
  "Status": "Inactive"
}
This updates only the Status field while keeping all other fields unchanged.

Best Practices

  1. Always include _version: The version field is required for updates to prevent data conflicts.
  2. Handle version conflicts: Implement retry logic for scenarios where concurrent updates may occur.
  3. Update only changed fields: Send only the fields that need to be updated to minimize payload size.
  4. Validate before updating: Ensure updated values meet schema requirements before sending.
  5. Log update operations: Keep track of updates for audit purposes.