Documentation Index
Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
Use this file to discover all available pages before exploring further.
Goal
The Automation API uses aparamsIO object to filter, paginate, and sort query collections. This tutorial demonstrates practical use cases for paramsIO, including:
- Retrieving multiple
siteIds usingsiteCodevalues - Filtering experiments by status
- Setting pagination criteria to control result size
paramsIO pattern is used across many endpoints and follows a consistent structure, making it a powerful tool for precise data retrieval.
Requirements
Access token
The Automation API requires an access token. Retrieve the token programmatically by following the instructions in the Get started article.Understanding paramsIO
TheparamsIO object passes structured queries to API endpoints. It typically includes pagination, sorting, and filtering tools. Refer to the Get started article for more information on paramsIO.
Filter Structure
Filters use a consistent JSON structure:| Property | Type | Description |
|---|---|---|
field | String | The property in the collection to filter by (for example, "code", "status") |
operator | String | The comparison operator (for example, "EQUAL", "BETWEEN", "GREATER") |
parameters | Array | An array of values to match against |
Filter JSON objects must be URL-encoded when added to the endpoint URL. For example,
[ becomes %5B and " becomes %22.Use case 1: Retrieve multiple siteIds by siteCode
The Automation API requires the internal numericid for most operations. This example retrieves multiple site IDs simultaneously using siteCode values.
Step 1: Define the filter
To retrieve multiple sites, use theEQUAL operator with an array of site codes:
Step 2: Send the request
Send aGET request to the /sites endpoint with the URL-encoded filter:
Endpoint: GET https://api.kameleoon.com/sites
Example request:
Step 3: Handle the response
The API returns all matching sites in a JSON array:id values for subsequent API operations.
Use case 2: Filter active experiments with pagination
This example demonstrates how to combine filtering and pagination to retrieve active experiments in manageable batches.Step 1: Define the filter and pagination
Create a filter for active experiments and specify pagination parameters: Filter JSON:page=1: First page of resultsperPage=200: Limit to 200 items per page
Step 2: Send the request
Send aGET request to the /experiments endpoint:
Endpoint: GET https://api.kameleoon.com/experiments
Example request:
Step 3: Handle the response
The API returns up to 200 active experiments:page parameter in subsequent requests.
Use case 3: Combining multiple filters
To query more precisely, combine multiple filter conditions. For example, find active experiments on a specific site:Best Practices
- URL Encoding: URL-encode the filter JSON before adding it to the request URL.
- Pagination: Use
perPageto limit result size and prevent timeouts on large collections - Multiple filters: Combine filter conditions to reduce unnecessary data transfer
- Operator choice: Use operators for multiple values instead of multiple separate requests