广告账户消耗信息

通过账号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>  ​                   
    }     
}
字段类型注释
idString广告账户ID
access_tokenString联系开发人员获取token,token是和公司主体绑定的
sinceDate开始时间,YYYY-MM-DD
untilDate结束时间,YYYY-MM-DD
date_presetString报告时间(如果传入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}
fieldsList<String>查询的账户字段 eg[:’id’,’account_id’,’name’] 根据传入的字段返回相应字段值
time_incrementStringtime_increment=1是每天一条数据,time_increment=monthly是每个月一条数据,time_increment=all_days是整个时间段一条数据(不传time_increment默认就是all_days)
search_idString唯一标识一个请求

返回的结果:

{
    "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_headerObject
codeInt返回的编码,1:成功
messageString返回的提示信息
search_idString唯一标识一个请求
dataJsonArray
spendDecimal花费金额
purchase_roasJsonArray购买广告支出的总回报率(ROAS)
action_typeString行动类型,app_custom_event
valueString数值
date_startDate开始时间
date_stopDate结束时间

错误编码:

编码注释
1001系统异常
1002id 不能为空
1003id 参数无效
1009fields 不能为空
1010fields 参数无效
1011Facebook API 请求超时
1015缺少时间范围相关参数或参数错误
1016时间范围的开始日期不能超过当前日期的37个月
1017total_postbacks 字段只能单独查询
1024time_increment 参数无效
1025单次查询分天消耗最多不能超过N天