facebook ads api

api测试

 

 

https://developers.facebook.com/tools/explorer/517735271920003?method=GET&path=act_1107316072738457%2Finsights%3F%26fields%3Dclicks%2Cimpressions%2Cspend%26level%3Daccount%26breakdowns%3D%26time_increment%3D1%26time_range%3D%7B'since'%3A'2017-11-26'%2C'until'%3A'2017-12-26'%7D&version=v2.11

 

 

 

 

me/adaccounts

 

 

#getting ad accounts 获取到ad node

2、FB.api('/me/adaccounts');  FB.api('/me/adaccounts?fields=id,name');  FB.api('act_221377094983518?fields=id,name');

#creating campaigns 创建广告系列

3、FB.api('/act_221377094983518/campaigns', 'POST', {'name':'我的广告','objective':'LINK_CLICKS'}); MOBILE_APP_INSTALLSCONVERSIONS

#updating campaigns 修改广告系列的相关设置

4、FB.api('23842545377820361', 'POST', {'status':'PAUSED'}); //暂停

 

 app 添加products:marketing api

 

 

添加account授权

 

 

 

获取token

 

 

 

 

 

获取userid、过期时间、short time access token

 

 

获取long time user access token:(60天有效期)

oauth/access_token?grant_type=fb_exchange_token&client_id=***********&client_secret=********&fb_exchange_token={short-time-access-token}

 

获取app access token:

oauth/access_token?client_id=********&client_secret=**********&grant_type=client_credentials

 

获取short time user access token:(2小时有效期)

登陆=》调用callbackurl,给出accesstoken=》添加app id、app secret后获取long time access token=》保存=》调用接口使用

类似授权登陆的流程

 

 

 

接口调用,graph api explorer可以不用添加param:access_token={valid access token}

 

me/adaccounts

{user id}/adaccounts

 

act_{ads account id}/users

/// <summary>
/// SystemUserId or UserId.
/// 
///( SystemUserId
/// https://graph.facebook.com/API_VERSION/BUSINESS_ID/system_users
/// ref:https://developers.facebook.com/docs/marketing-api/businessmanager/systemuser)
/// 
///( UserId
/// ref:https://developers.facebook.com/docs/graph-api/reference/user/
/// https://graph.facebook.com/API_VERSION/me/ids_for_business)
/// </summary>

  

act_{ads account id}/insights?

 

 

act_{ads account id}/insights?fields=account_id,account_name,campaign_id{cost_per_action,results},campaign_name,date_stop,date_start,clicks,impressions,total_action_value,total_actions,spend,actions,action_values,website_purchase_roas,reach&level=account&breakdowns=&time_increment=1&action_attribution_windows=1d_view,28d_click,default&time_range={'since':'2018-01-01','until':'2018-01-22'}

 

 

#facebook 获取report
curl "https://graph.facebook.com/v2.11/act_1534433596654710/insights?access_token=************************&fields=account_id,account_name,campaign_id{cost_per_action,results},campaign_name,d
ate_stop,date_start,clicks,impressions,total_action_value,total_actions,spend,actions,action_values,website_purchase_roa
s,reach&level=account&breakdowns=&time_increment=1&action_attribution_windows=1d_view,28d_click,default&time_range={'sin
ce':'2018-01-01','until':'2018-01-29'}"

 

 

 

 

https://developers.facebook.com/docs/applinks/metadata-reference
https://developers.facebook.com/docs/marketing-api/dynamic-product-ads/debugging-tools/event_statistics/v2.12
https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/insights/
https://developers.facebook.com/docs/marketing-api/reference/ad-report-run/
https://developers.facebook.com/docs/marketing-api/targeting-specs
https://developers.facebook.com/docs/marketing-api/targeting-search#country_group
https://developers.facebook.com/docs/marketing-api/reference/ads-action-stats/  #action_device  

 

posted @ 2017-12-27 17:02  PanPan003  阅读(1676)  评论(0编辑  收藏  举报