Get rules by ID
GET/optimizer/rule/get/Via 360: GET https://partner.quantri360.com/v1/tiktok_business/optimizer/rule/get/
Description
Use this endpoint to get rules by rule IDs.
Request
Endpoint
GET https://partner.quantri360.com/v1/tiktok_business/optimizer/rule/get/
Authentication & shop
| Name | In | Type | Sample | Description |
|---|---|---|---|---|
| Authorization | header | header | Bearer q360_live_ab12cd34_… | Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand. |
| platform_shop_id | query | string | 7000000000000000001 | Tài sản TikTok Business đã kết nối — "Mã tài sản" ở trang Nền tảng hoặc GET /v1/platforms (tài khoản quảng cáo cho Marketing API, tài khoản TikTok cho Organic / Messaging). Có thể bỏ khi chỉ kết nối một tài sản. |
Request parameters
| Name | In | Type | Required | Sample | Description |
|---|---|---|---|---|---|
| rule_ids | query | string[] | Yes | IDs of the rules that you want to get |
Request examples
curl -s "https://partner.quantri360.com/v1/tiktok_business/optimizer/rule/get/?rule_ids=%5B%5D" \ -H "Authorization: Bearer $KEY"
Python
import requests
KEY = "q360_live_..." # khóa API của brand
r = requests.get(
"https://partner.quantri360.com/v1/tiktok_business/optimizer/rule/get/",
params={
"rule_ids": []
},
headers={"Authorization": f"Bearer {KEY}"},
timeout=60,
)
print(r.status_code)
print(r.json())Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/tiktok_business/optimizer/rule/get/');
for (const [k, v] of Object.entries({"rule_ids":[]})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
method: 'GET',
headers: { Authorization: `Bearer ${KEY}` },
});
console.log(r.status, await r.json());PHP
<?php $key = 'q360_live_...'; // khóa API của brand $url = 'https://partner.quantri360.com/v1/tiktok_business/optimizer/rule/get/' . '?' . http_build_query(['rule_ids' => '[]']); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]); $res = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status, "\n", $res;
Response
Response fields (as returned by TikTok Business)
| Name | Type | Sample | Description |
|---|---|---|---|
| code | number | Response code. For the complete list of response codes and descriptions, see Appendix - Return Codes. | |
| message | string | Response message. For details, see Appendix - Return Codes. | |
| request_id | string | Unique ID of the request. | |
| data | object | Returned data. | |
| page_info | object | Pagination information. | |
| page | number | Current page number. | |
| page_size | number | Page size. | |
| total_number | number | Total number of results. | |
| total_page | number | Total pages of results. | |
| rules | object[] | List of rules | |
| apply_objects | object[] | Objects that you want to apply the rules to. Objects can be campaigns, ad groups, or ads. | |
| dimesion | string | Category of the object. Enum values: `CAMPAIGN`, `ADGROUP`, `AD`. | |
| dimension_ids | string[] | IDs of the objects | |
| pre_condition_type | string | Conditions to filter out objects that you do not want to include. - `SELECTED`: Only include those that are selected by IDs. - `ALL_ACTIVE_CAMPAIGN`: Select all active campaigns. - `ALL_ACTIVE_AD_GROUP`: Select all active ad groups. - `ALL_ACTIVE_AD`: Select all active ads. - ` ALL_ACTIVE_AD_GROUP_UNDER_SELECTED`: Select all active ad groups under the selected campaign. - `ALL_ACTIVE_AD_UNDER_SELECTED`: Select all active ads under selected dimensions - `ALL_INACTIVE_CAMPAIGN`: Select all inactive campaigns. - `ALL_INACTIVE_AD_GROUP`: Select all inactive ad groups - `ALL_INACTIVE_AD`: Select all inactive ads. - `ALL_INACTIVE_AD_GROUP_UNDER_SELECTED`: Select all inactive ad groups under the selected campaign. - `ALL_INACTIVE_AD_UNDER_SELECTED`: Select all inactive ads under the selected campaign or ad group (specified by `dimension` and `dimension_ids`) | |
| bind_type | string | Bind type of the rule. Enum values: `BIND`, `UNBIND`. | |
| conditions | object[] | Conditions | |
| subject_type | string | Subjects that the condition will be based on. Enum values: - `COST` - `DAILY_BUDGET_SPENDING_RATE` - `LIFETIME_BUDGET_SPENDING_RATE` - `IMPRESSION` - `CLICK` - `CONVERSION` - `CONVERSION_SKAN` - `CVR` - `CVR_SKAN` - `CPA` - `CPM` - `CPC` - `CTR` - `COST_PER_RESULT` - `RESULT` - `RESULT_RATE` - `BID_STRATEGY` - `OPTIMIZATION_GOAL` - `OBJECTIVE` - `NAME` - `DAYS_SINCE_CREATION` - `NO_CONDITION` - `ROAS_PURCHASE` - `ROAS_IMPRESSION_ADS` - `ROAS_PURCHASE_SKAN` - `ROAS_COMPLETE_PAYMENT` - `ROAS_PURCHASES_ONSITE` - `NOT_REAL_TIME_CPA` - `NOT_REAL_TIME_CONVERSION` - `NOT_REAL_TIME_CVR` | |
| range_type | string | Time range for the condition. Enum values: - `TODAY` - `YESTERDAY` - `PAST_THREE_DAYS` - `PAST_FIVE_DAYS` - `PAST_SEVEN_DAYS` - `LIFETIME` | |
| match_type | string | Operator to connect a condition with a value. Enum values: - `GT` (greater than) - `LT` (less than) - `BETWEEN` - `MATCH` - `CONTAINS` - `NOT_CONTAINS` - `START_WITH` - `END_WITH` - `STRING_EQUAL` | |
| values | string[] | Values for the condition. | |
| calculation_type | string | Enum values: - `ALL_OBJECTS` - `OF_EACH_OBJECT` | |
| action | object[] | Actions to be taken when the condition is met | |
| subject_type | string | Type of actions to take. Enum: `TURN_ON`, `TURN_OFF`, `MESSAGE`, `DAILY_BUDGET`, `LIFERIME_BUDGET`, `BID` | |
| action_type | string | Enum values: `INCREASE`, `DECREASE`, `ADJUST_TO` | |
| value_type | string | Enum values: `EXACT`, `PERCENT` | |
| value | object | - When `action_type` is `INCREASE` or `DECREASE`, users can specify the maximum(if `INCREASE`) or minimum(if `DECREASE`) budget using `use_limit` and `limit`. - When `action_type` is `ADJUST_TO`, no need to provide `use_limit` and `limit`. | |
| frequency_info | object | Frequency settings. It can be used when the action `subject_type` is `DAILY_BUDGET`, `LIFERIME_BUDGET`, or `BID` | |
| type | string | Enum: - `ONLY_ONCE` - `ONCE_IN_24_H` - `ONCE_IN_48_H` - `ONCE_IN_1_W` - `CUSTOM` | |
| custom_frequency_type | string | Custom frequency type. Valid only when `type` is `CUSTOM`. Enum: - `N_MINTUE_Y_TIMES` - `N_HOUR_Y_TIMES` - `N_DAY_Y_TIMES` | |
| time | number | It is the `N` in `custom_frequency_type` | |
| count | number | It is the `Y` in `custom_frequency_type` | |
| notification | object | Notification settings | |
| notification_type | string | Notification type you need. Enum values: - `TASK_FINISH`: Notification will be sent when the task is finished. This option is only for `MESSAGE` subject type. - `ANY_CHANGES`: If the `subject_type` for the action is not `MESSAGE` but you still want to receive emails, use this option. - `NOT_NOTIFICATION`: No notifications are needed. | |
| email_setting | object | Email notification settings | |
| notification_period | string | Enum values: - `EVERY_TIME` - `TIME_SCHEDULE`: notifications will be sent together around a specified time. | |
| email_exec_time | string[] | Required when `notification_period` is`TIME_SCHEDULE`. Notification email sent time. For example, "12:00". | |
| no_result_notification | boolean | It will be set as false by default if not provided, meaning no notification will be sent if there is no result. | |
| rule_exec_info | object | Rule run settings | |
| exec_time_type | string | When the rule will be run. Enum values: - `PER_HALF_HOUR`: the rule will be run every half hour. - `CUSTOM`: the rule will be run at a customized time (specified in the `exec_time` field). - `HALF_HOUR_IN_SPECIFIC_TIME_PERIOD`: the rule will be run every 30 minutes during specified time range on specifed days during the week - `SPECIFIC_TIME_ACCURATE_ONCE`: the rule will be run only once at a customized time (specified in the `exec_time` field). | |
| exec_time | string | If `exec_time_type` is set to `CUSTOM` or `SPECIFIC_TIME_ACCURATE_ONCE`, use this field to specify the exact time when the rule will be run. Format: - "HH:MM" when `exec_time_type` is `CUSTOM`. For example: "12:00". - "YYYY-MM-DD HH:MM" when `exec_time_type` is `SPECIFIC_TIME_ACCURATE_ONCE`. For example: "2023-04-20 04:20". | |
| time_period_info | object[] | Valid when `exec_time_type` is `HALF_HOUR_IN_SPECIFIC_TIME_PERIOD`. It has `start_time`, `end_time`, `date_type` and `num` to specify the time period information. | |
| num | integers[] | Each number in the list represents the day in the week or month. - When `date_type` is `WEEK`, value range for this field is [1, 7], meaning Monday to Sunday. - When `date_type` is `MONTH`, value range for this field is [1, 28], meaning 1st day to the 28th day of the month. | |
| start_time | string | Start time of this time period. For example, "12:00". | |
| end_time | string | End time of this time period. For example, "12:00". | |
| date_type | string | Type of date. Enum values: `DAY`, `WEEK`, `MONTH`. | |
| last_check_result_summary | object | Information about the last rule run | |
| check_datetime | string | Date and time when the rule was checked, in UTC+0 time zone | |
| exec_datetime | string | Date and time when the rule was run, in UTC+0 time zone | |
| change_success | number | Objects that have been changed | |
| no_change | number | Objects that have not been changed | |
| change_fail | number | Objects that failed to be changed | |
| task_exec_id | string | Rule execution ID | |
| rule_id | string | ID of the rule | |
| name | string | Name of the rule | |
| rule_status | string | Rule status. Enum values: - `ON`: on. - `OFF`: off. - `DELETED`: deleted. | |
| create_datetime | string | Date and time when the rule was created, in UTC+0 time zone |
Response sample
{
"code": 0,
"message": "OK",
"request_id": "202107290652080102450151363E025325",
"data": {
"rules": [
{
"rule_exec_info": {
"exec_time": "",
"exec_time_type": "PER_HALF_HOUR"
},
"rule_status": "ON",
"name": "[API]Automated Rule--example-update",
"notification": {
"notification_type": "TASK_FINISH"
},
"rule_id": "6984697088064290818",
"create_datetime": "2021-07-29 06:45:04",
"actions": [
{
"subject_type": "MESSAGE"
}
],
"last_check_result_summary": {
"change_fail": 0,
"check_datetime": "0001-01-01 00:00:00",
"change_success": 0,
"task_exec_id": "0",
"not_change": 0,
"exec_datetime": "0001-01-01 00:00:00"
},
"apply_objects": [
{
"dimension_ids": [
"1694011873852465"
],
"dimension": "CAMPAIGN",
"bind_type": "BIND",
"pre_condition_type": "SELECTED"
}
],
"conditions": [
{
"subject_type": "CLICK",
"values": [
"1"
],
"match_type": "GT",
"range_type": "LIFETIME"
}
]
}
],
"page_info": {
"total_page": 1,
"page_size": 10,
"total_number": 1,
"page": 1
}
}
}
Get started
- Sign up for Partner
- Enable a data type of the Ads (Marketing API) group on the platform page
- Create an API key (tick the TikTok Business channel)
- Call it as in the examples above