Learn how to search and retrieve master data objects using the Pretectum API
This guide walks you through searching for data objects in Pretectum using the API. You will learn how to authenticate, construct search queries, and handle the results.
Contact your Pretectum tenant administrator to obtain your client_id and client_secret. These credentials identify your application and grant access to the API.
2
Understand Your Data
Familiarize yourself with the business areas, schemas, and datasets in your tenant. This knowledge helps you construct effective search queries.
3
Set Up Your Environment
Ensure you have a way to make HTTP requests from your application. This guide includes examples using cURL, JavaScript, and Python.
To get the list of schema names within a business area, use the List Schemas endpoint. See the Working with Schemas guide for complete examples.
To get the list of dataset names within a schema, use the List Datasets endpoint. See the Working with Datasets guide for complete examples.
Copy
# Search within a specific business areacurl -X GET "https://api.pretectum.io/dataobjects/search?query=John&businessArea=Customer" \ -H "Authorization: your_access_token"# Search within a specific schemacurl -X GET "https://api.pretectum.io/dataobjects/search?query=John&businessArea=Customer&schema=Individual%20Customer" \ -H "Authorization: your_access_token"# Search within a specific datasetcurl -X GET "https://api.pretectum.io/dataobjects/search?query=John&dataSet=US%20Customers" \ -H "Authorization: your_access_token"
The search query supports two types of searches: full-text search across all fields, and field-specific search for filtering by attribute values.
Full-Text Search
Search for terms across all indexed fields:
Copy
# Simple term searchquery=John# Multiple terms (implicit AND)query=John Smith# Phrase search for exact matchquery="John Smith"# Wildcard searchquery=Jo*
Boolean Operators
Combine terms with AND, OR, NOT operators:
Copy
# Find records with both termsquery=John AND Smith# Find records with either termquery=John OR Jane# Exclude records with a termquery=John NOT Doe# Group conditions with parenthesesquery=(John OR Jane) AND Smith
Field-Specific Search (Attribute Filtering)
Filter by specific attribute values using field:value syntax:
Copy
# Search by first namequery=firstName:John# Search by last name with multiple valuesquery=lastName:(Smith OR Johnson)# Search by email domainquery=email:*@example.com# Search nested fields with dot notationquery=address.city:"New York"query=address.state:CA# Combine multiple field filtersquery=firstName:John AND address.state:NY# Check if field existsquery=_exists_:email# Check if field is missingquery=NOT _exists_:phone
Range Queries
Filter by numeric or date ranges:
Copy
# Inclusive range (18 to 65)query=age:[18 TO 65]# Greater thanquery=age:>21# Less than or equalquery=price:<=100# Date rangequery=createdDate:[2024-01-01 TO 2024-12-31]# After a specific datequery=updatedDate:>2024-01-01
Comparison Operators (eq, ne, gt, lt)
Use comparison operators with bracket notation for field names with spaces:
Copy
# Equals - find customers where First Name is "Tim"query=[First Name] eq "Tim"# Not equals - exclude inactive recordsquery=[Status] ne "Inactive"# Greater thanquery=[Age] gt 21# Less than or equalquery=[Price] le 500# Contains substringquery=[Email] contains "example.com"# Starts withquery=[Last Name] startswith "Sm"# Combine operators with and/orquery=[First Name] eq "Tim" and [Last Name] eq "Smith"query=[State] eq "CA" or [State] eq "NY"# Complex conditionsquery=([State] eq "CA" or [State] eq "NY") and [Status] eq "Active"
Complex Query Examples
Combine multiple search patterns:
Copy
# Customer in California with name Johnquery=firstName:John AND address.state:CA# Products in price range with specific categoryquery=category:Electronics AND price:[100 TO 500]# Active customers with recent ordersquery=status:Active AND lastOrderDate:>2024-01-01# Multi-condition searchquery=(firstName:John OR firstName:Jane) AND address.state:NY AND NOT status:Inactive# Full-text combined with field filtersquery="premium customer" AND customerType:Enterprise
For a complete reference of all query syntax options, see the Search API Reference.