Filtering Rules - Toggle Status
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
/i/blocks/toggle_status
Overview
Enables or disables one or more existing filtering rules.
Authentication
Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.
Permissions
- Filtering Rules:
Updatepermission (or global admin equivalent).
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | String | Yes (or auth_token) | API key authentication |
auth_token | String | Yes (or api_key) | Auth token authentication |
app_id | String | Yes | Application ID |
blocks | String | Yes | Stringified JSON object in { "ruleId": true/false } form |
Examples
Example: Enable one rule and disable another
curl "https://your-server.com/i/blocks/toggle_status?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&blocks=%7B%22rule1%22%3Atrue%2C%22rule2%22%3Afalse%7D"
Response
Success Response
{
"result": "Success"
}
Response Fields
| Field | Type | Description |
|---|---|---|
result | String | Operation status |
Error Responses
- HTTP 400 - Missing app ID:
{
"result": "Provide app_id"
}
- HTTP 400 - Missing/invalid block object:
{
"result": "Provide block object"
}
- HTTP 400 - Toggle failure:
{
"result": "Error adding rule"
}
- HTTP 400 - Missing auth params:
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
- HTTP 401 - Auth/user validation failed:
{
"result": "User does not exist"
}
Behavior
- Validates
app_idand update permission. - Parses
blocksmap. - Updates status for each provided rule ID.
Related Endpoints
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly.apps | App configuration and metadata | Stores app-level feature settings and metadata used or modified by this endpoint. |