Skip to main content
POST
Create Data Object
The Create Data Object endpoint allows you to add new records to a dataset. The data object structure is determined by the schema definition, and the API validates field values according to schema rules.

Prerequisites

Authentication

Include your API key in the Authorization header.

Request

Path Parameters

string
required
The unique identifier of the business area. You can obtain this from the List Business Areas endpoint.
string
required
The unique identifier of the schema that defines the data structure. You can obtain this from the List Schemas endpoint.
string
required
The unique identifier of the dataset where the data object will be created. You can obtain this from the List Datasets endpoint.

Headers

string
required
Your Pretectum API key. Create one in the Pretectum app under Configuration → API Keys.
string
required
Must be application/json.
string
default:"application/json"
The response content type. Currently only application/json is supported.

Request Body

The request body should be a JSON object with field names as keys and their values. Field names must match the schema field names exactly.
varies
required
Dynamic fields based on the schema definition. Use the field names as defined in the schema. Values should be formatted according to the field’s data type:
  • string: Plain text values
  • integer: Whole numbers
  • float: Decimal numbers
  • boolean: true or false
  • date: Date string in the format defined by the schema (e.g., “MM/DD/YYYY”)
  • datetime: DateTime string in the format defined by the schema
  • time: Time string in the format defined by the schema
  • email: Valid email address
  • url: Valid URL
  • phone: Phone number string
  • picklist: Value from the predefined list

Example Requests

Response

A successful request returns the created data object with system-generated fields.
string
required
The unique identifier generated for the new data object.
integer
required
The version number of the data object. A newly created object starts at version 0; each successful update increments it by one. Send the current value as _version when updating.
array
required
An array of validation errors. If the data doesn’t conform to schema validation rules, errors will be listed here. The data object is still created, but flagged with errors.
varies
The field values as stored in the system. These may be transformed based on schema rules (e.g., date formatting).

Example Response

Response with Validation Errors

If the data doesn’t conform to schema rules, the object is created but flagged with errors:

Error Responses

Validation

The API validates field values based on the schema definition:
  • Required fields: Fields marked as required in the schema must have a value.
  • Data types: Values must match the expected data type (e.g., integers for integer fields).
  • Format validation: Emails, URLs, phones, and dates are validated against their expected formats.
  • Picklist values: Values must be from the predefined list if the field is a picklist.
Data objects with validation errors are still created but flagged in the _errors array. This allows you to import data and fix validation issues later.

Best Practices

  1. Validate before sending: Validate data on the client side before making API calls to reduce errors.
  2. Use correct field names: Field names are case-sensitive and must match the schema exactly.
  3. Handle errors gracefully: Check the _errors array in the response to identify and report validation issues.
  4. Store the ID: Save the _dataObjectId for future updates or deletions.
  5. Batch imports: For large data imports, consider using the batch import feature instead of individual API calls.

List Data Objects

Retrieve records from a dataset

Update Data Object

Modify existing records

Delete Data Object

Remove records from a dataset

Get Data Object by Primary Key

Fetch one record by its primary key value

Get Schema Details

View schema field definitions