逐页读取广告活动
从空 cursor 开始,保持过滤条件不变,使用 meta.next_cursor 翻页直到其为 null。每页最多返回 500 条活动记录。
仅 GET /v1/campaigns 列表使用分页,支持两种模式。
游标分页
首次请求发送空的 cursor=,随后使用返回的 meta.next_cursor,直到其值为 null。
curl -s "https://orbitoads.pro/api/v1/campaigns?limit=500&cursor=" -H "X-API-Key: $ORBITO_API_KEY"{
"success": true,
"data": [ { "ad_id": 90412, "account_id": 53, "…": "…" } ],
"meta": { "limit": 500, "cursor": null, "next_cursor": "eyJhIjo1MywiaSI6OTAzMTB9", "hasMore": true }
}def all_campaigns():
cursor = ""
while True:
r = requests.get("https://orbitoads.pro/api/v1/campaigns",
params={"limit": 500, "cursor": cursor},
headers={"X-API-Key": API_KEY}, timeout=60).json()
yield from r["data"]
cursor = r["meta"]["next_cursor"]
if not cursor:
break- 将光标视为不透明。 它仅对相同的过滤器有效 。
- 秩序是固定的(cabinet,后为最新
ad_id先行),因此页面在加入广告活动的同时保持稳定. - 没有上限——这就是你如何读取一个10万个广告活动的内阁.
- 滤镜
bot_username,promote_domain和type总是使用光标模式. - cursor 模式省略出几个重字段(目标摘要,媒体,最后动作). 使用
GET /v1/campaigns/{ad_id}来完整记录一次战役.
小型账户的偏移量分页
没有cursor,端点页有limit和offset并可以排序(sortBy,sortOrder). 它最多读取了广告账户500个活动:过去meta.truncated是true,meta.next_step指示您切换到光标模式.
"meta": { "total": 1240, "limit": 100, "offset": 0, "hasMore": true, "truncated": true,
"next_step": "Use ?cursor= for full traversal beyond 500 campaigns per cabinet" }每页数量
每页 limit 可设为 1–500,默认 100。
API 参考
完整广告接口需要为此工作区单独配置供应商凭据。客户端请求使用自己的 Orbito API 密钥。账户订购、开通和外部账单分别处理。
curl -X GET 'https://orbitoads.pro/api/v1/campaigns?account_id=7401&status=Active%2COn+Hold&limit=25&cursor=' \
-H 'X-API-Key: YOUR_ORBITO_KEY'curl -X GET 'https://orbitoads.pro/api/v1/campaigns?account_id=7401&status=Active%2COn+Hold&limit=25&cursor=OPAQUE_NEXT_CURSOR' \
-H 'X-API-Key: YOUR_ORBITO_KEY'实施说明
读取完整列表
GET /api/v1/campaigns 首次传 cursor= 和筛选条件。下一页保持筛选不变,原样传入 meta.next_cursor,直至 null。limit 为 1–500,默认 100。
排序与偏移限制
游标按账户、再按 ad_id 降序。bot_username、promote_domain、type 会启用该模式。偏移模式支持 sortBy、sortOrder,每账户最多 500 条;meta.truncated 表示需改用游标。
操作与字段
GET /api/v1/campaigns cursor meta.next_cursor limit offset
- GET /api/v1/campaigns
- cursor
- meta.next_cursor
- limit
- offset
请求示例
GET /api/v1/campaigns?limit=500&cursor= HTTP/1.1 Host: orbitoads.pro X-API-Key: {key}
结构字段与限制
本表依据公开的 v1 契约。参数与字段名称区分大小写。各操作的 HTTP 状态码分别表示成功、输入校验和访问检查。链接规范给出了完整的请求与响应结构。
协议参考
| 方法 | 路径 | 参数 | 请求内容 | 响应码 |
|---|---|---|---|---|
| GET | /api/v1/campaigns | account_id, status, title, bot_username, promote_domain, promote_domain_mode, type, limit, cursor, offset, sortBy, sortOrder | — | 200, 400, 401, 404, 429 |
来源 · 数据来源
结构字段与限制 · 逐页读取广告活动
| 字段 | 文档取值 |
|---|---|
| limit | 1 … 500 |
| limit = | 100 |
| cursor | string |
| meta.next_cursor | string | null |
| sortBy = | date |
| sortOrder = | DESC |
来源 · 数据来源
CampaignListItem
| 字段 | 字段类型 |
|---|---|
| ad_id | integer |
| account_id | integer |
| title | string |
| text | string | null |
| status | CampaignStatus |
| tme_path | string | null |
| promote_url | string | null |
| views | integer |
| opens | integer |
| clicks | integer |
| actions | integer |
| spent | Money |
| budget | Money |
| cpm | Money |
| cpc | Money |
| cpa | Money |
| ctr | string | null |
| cvr | string | null |
| date | string | null |
| group_id | integer | null |
| status_changed_at | string | null · date-time |
来源 · 数据来源
参考资料更新日期