Skip to main content
This guide explains how to work with schemas in Pretectum using the API. You will learn how to retrieve schema definitions, understand field structures, and use schemas effectively for searching and organizing data.

Overview

Schemas define the structure of your data objects in Pretectum. Each schema specifies:
  • Fields: The attributes that data objects contain (e.g., First Name, Email, Phone)
  • Data Types: The type of data each field holds (string, number, date, etc.)
  • Validation Rules: Requirements like mandatory fields and unique constraints
  • Search Configuration: Which fields are indexed for searching
Schemas are organized within business areas, creating a hierarchy:

Why Schemas Matter

Understanding your schemas is essential for:
  1. Effective Searching: Know which fields are searchable and their exact names
  2. Data Validation: Understand required fields and data types
  3. Building Integrations: Create forms and interfaces that match your data structure
  4. Query Optimization: Target searches to specific fields for better results

Before You Begin

To use the Schema APIs, you need:
1

Create an API Key

In the Pretectum app, go to Configuration → API Keys and create a key. It is shown once, at creation, so copy it then. See API Keys.
2

Get Business Area IDs

Retrieve business area IDs using the List Business Areas endpoint. Schema queries require a business area ID.

Listing Schemas in a Business Area

To get schemas, you first need the business area ID, then query for schemas within that area.

Step 1: Get Business Area ID

Step 2: List Schemas

Understanding the Response

Getting Schema Details

Retrieve complete schema information including field definitions:

Example Response

Use schema and field information to construct effective search queries.

Filtering by Schema Name

Searching by Field Names

Use the field names from the schema to construct field-specific queries:
Field names with spaces must be enclosed in brackets when using comparison operators: [First Name] eq "John"

Complete Client Implementation

Here is a complete implementation that handles business areas, schemas, and searching:

Building a Schema-Aware Search Interface

Create cascading dropdowns for business area and schema selection:

Error Handling

Handle common errors when working with schemas:

Best Practices

Schemas change infrequently. Cache responses to reduce API calls:
When filtering searches, use the schema name, not the schemaId:
Before building field-specific queries, verify the field is searchable:
Always check for pageKey in schema list responses:

Next Steps

List Schemas API

View the complete List Schemas API reference

Get Schema API

View the Get Schema API reference

Search Data Objects

Learn how to search within schemas

Business Areas

Learn about business areas