通过账号ID,时间范围,spend,purchase_roas等条件查询账号的消耗数据,GET请求。
GET /account_insights HTTP/1.1
Host: /lb/api/v1/
请求参数:
{
"id": <String>,
"access_token": <String>,
"time_range":{
"since":<Date>,
"until":<Date>,
},
"date_preset":<String>,
"fields": List<String>,
"time_increment":<String>,
"req_header": {
"search_id": <String>
}
}
字段 | 类型 | 注释 |
id | String | 广告账户ID |
access_token | String | 联系开发人员获取token,token是和公司主体绑定的 |
since | Date | 开始时间,YYYY-MM-DD |
until | Date | 结束时间,YYYY-MM-DD |
date_preset | String | 报告时间(如果传入time_range则忽略该字段) enum{today, yesterday, this_month, last_month, this_quarter, maximum, data_maximum, last_3d, last_7d, last_14d, last_28d, last_30d, last_90d, last_week_mon_sun, last_week_sun_sat, last_quarter, last_year, this_week_mon_today, this_week_sun_today, this_year} |
fields | List<String> | 查询的账户字段 eg[:’id’,’account_id’,’name’] 根据传入的字段返回相应字段值 |
time_increment | String | time_increment=1是每天一条数据,time_increment=monthly是每个月一条数据,time_increment=all_days是整个时间段一条数据(不传time_increment默认就是all_days) |
search_id | String | 唯一标识一个请求 |
返回的结果:
{
"resp_header": {
"code": <Int>,
"message": <String>,
"search_id": <String>
},
"data": [{
"spend": <Decimal>,
"purchase_roas": [{
"action_type": <String>,
"value": <String>
}],
…
"date_start": <Date>,
"date_stop": <Date>
}]
}
字段 | 类型 | 注释 |
resp_header | Object | |
code | Int | 返回的编码,1:成功 |
message | String | 返回的提示信息 |
search_id | String | 唯一标识一个请求 |
data | JsonArray | |
spend | Decimal | 花费金额 |
purchase_roas | JsonArray | 购买广告支出的总回报率(ROAS) |
action_type | String | 行动类型,app_custom_event |
value | String | 数值 |
… | ||
date_start | Date | 开始时间 |
date_stop | Date | 结束时间 |
错误编码:
编码 | 注释 |
1001 | 系统异常 |
1002 | id 不能为空 |
1003 | id 参数无效 |
1009 | fields 不能为空 |
1010 | fields 参数无效 |
1011 | Facebook API 请求超时 |
1015 | 缺少时间范围相关参数或参数错误 |
1016 | 时间范围的开始日期不能超过当前日期的37个月 |
1017 | total_postbacks 字段只能单独查询 |
1024 | time_increment 参数无效 |
1025 | 单次查询分天消耗最多不能超过N天 |