Get Specific Experiments
Enterprise
This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.
Endpoint
/o/ab-testing/experiment
Overview
Retrieve multiple experiment definitions by their ObjectIds.
Authentication
Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.
Permissions
- Read (ab_testing feature)
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | String | Yes (or use auth_token) | API key for authentication |
auth_token | String | Yes (or use api_key) | Auth token for authentication |
app_id | String | Yes | Application ID |
experiments | String (JSON) | Yes | JSON array of experiment IDs |
Examples
Example 1: Read two experiments
Request:
curl "https://your-server.com/o/ab-testing/experiment?app_id=YOUR_APP_ID&experiments=[\"EXPERIMENT_ID_1\",\"EXPERIMENT_ID_2\"]&api_key=YOUR_API_KEY"
Response:
[
{
"_id": "6991caa6024cb89cdc04eff5",
"name": "Pricing1",
"status": "running"
}
]
Response
Success Response
[
{
"_id": "6991caa6024cb89cdc04eff5",
"name": "Pricing1",
"description": "TestPricing",
"target_users": {
"percentage": 100,
"condition": "{}"
},
"variants": [
{
"name": "Control group",
"parameters": [
{
"name": "Pricing1",
"value": "5000/month"
}
]
},
{
"name": "Variant A",
"parameters": [
{
"name": "Pricing1",
"value": "10000/month"
}
]
}
],
"status": "running"
}
]
Response Fields
| Field | Type | Description |
|---|---|---|
[] | Array | Experiment documents matching the requested IDs |
[].name | String | Experiment name |
[].variants | Array | Variant definitions with parameter values |
[].status | String | Experiment status |
Error Responses
- If parsing
experimentsfails, the handler continues with an empty ID list and returns[]. - If no matching IDs are found, returns
[].
Behavior
- Parses
experimentsas JSON and converts each ID to an ObjectID. - Fetches experiment documents from
countly_out.ab_testing_experiments{appId}. - Returns an empty array if none are found.
Limitations
experimentsmust be valid JSON. Invalid JSON returns an empty result.- Batch experiment IDs to reduce network overhead.
Related Endpoints
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly_out.ab_testing_experiments{appId} | Endpoint data source | Stores endpoint-related records this endpoint reads or modifies. |