facebook api之Ad
Ad
Contains information to display an ad and associate it an ad set. Each ad is associated with an ad set and all ads in a set have the same daily or lifetime budget, schedule, and targeting. Creating multiple ads in an ad set helps optimize their delivery based on variations in images, links, video, text or placements.
You can still create Event Ads and Link Ads if you provide a valid actor_id
in the ad creative's object_story_id
or object_story_spec
fields
These options used together are valid:
- Event Ads
- Objective:
EVENT_RESPONSES
- Creative fields:
object_story_id
orobject_story_spec
- Objective:
- Link Ads
- Objective:
LINK_CLICKS
- Creative fields:
object_story_id
orobject_story_spec
- Objective:
The nodes, edges and requests impacted are:
Any pre-existing Event or Link Ads continue to run but you cannnot modify these ad's creatives or create new ads with the invalid options once the change goes in effect.
#Creating an ad: # Upload image for your ad creative
curl \
-F "image.jpg=@myimage.jpg" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adimages" # Provide ad creative with image hash ID returned in previous call
curl \
-F "name=sample creative" \
-F "title=hello world" \
-F "body=hi i'm an ad" \
-F "object_url=www.facebook.com" \
-F "image_hash=<IMAGE_HASH>" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adcreatives" # Create ad with ad creative.
curl \
-F "name=my ad" \
-F "adset_id=<AD_SET_ID>" \
-F "creative={'creative_id':<AD_CREATIVE_ID>}" \
-F "status=PAUSED" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/ads" # Asynchronous creation.
curl \
-F "name=testasyncset" \
-F "ad_specs=
[{'name':'name 1',
'adset_id':'<AD_SET_ID>',
'creative':{'creative_id':<AD_CREATIVE_ID>}},
{'name':'name 2',
'adset_id':'<AD_SET_ID>',
'creative':{'creative_id':<AD_CREATIVE_ID>}}]" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/asyncadrequestsets"
See:
An ad object contains the data necessary to visually display an ad and associate it with a corresponding ad set.
Permissions
Developers usually request these permissions for this endpoint:
Marketing Apps
ads_management
ads_read
Page management Apps
Other Apps
#By ad ID
curl -G \
-d "fields=name" \
-d "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<AD_ID>" #By ad account
curl -G \
-d "fields=name" \
-d "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/ads" #By ad campaign
curl \
-F "fields=name" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<CAMPAIGN_ID>/ads" #By ad set
curl \
-F "fields=name" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<AD_SET_ID>/ads"
Creating
Before you create an ad, you need an existing ad set and ad creative. You can create ads synchronously and asynchronously.
New ads are in pending state and do not run until Facebook approves or rejects them. After we approve an ad it runs. If you do not want an ad to automatically run after approval, create it and set it to paused
, see ad set. Run the set when you are ready.
#Synchronous Creation
#Creates one ad at a time:
curl \
-F 'name=My Ad' \
-F 'adset_id=<AD_SET_ID>' \
-F 'creative={"creative_id":"<CREATIVE_ID>"}' \
-F 'status=PAUSED' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/ads #Asynchronous Creation
#Create multiple ads at a time asynchronously. Receive a notification when all the ads in the request exist.
#Make an HTTP POST to: https://graph.facebook.com/{API_VERSION}/act_{AD_ACCOUNT_ID}/asyncadrequestsets #Download details for an ad:
curl \
-F "name=my ad" \
-F "adset_id=<AD_SET_ID>" \
-F "creative={'creative_id':<AD_CREATIVE_ID>}" \
-F "redownload=true" \
-F "status=PAUSED" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/ads" #You can make a POST request to copies edge from the following paths:
#/{ad_id}/copies
#When posting to this edge, an Ad will be created.
Permissions
Developers usually request these permissions for this endpoint:
Marketing Apps
ads_management
ads_read
manage_pages
pages_show_list
business_management
Page management Apps
Other Apps
ads
edge from the following paths:
#
curl -X POST \
-d "name=My+Ad" \
-d "adset_id=%7Bad-campaign-group-id%7D" \
-d "creative=%7B%22creative_id%22%3A%22%7Bi-ent-ad-creative-core-id%7D%22%7D" \
-d "status=PAUSED" \
https://graph.facebook.com/v2.12/act_{ad-account-id}/ads
You may perform a POST request to the following edges from this node:
#Updating #Update certain fields:
curl \
-F "name=New Ad Name" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<AD_ID>" #Update the name
curl \
-F "name=newname" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<AD_ID>" #Update the status:
curl \
-F "status=ADGROUP_PAUSED" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<AD_ID>" curl -X POST \
-d "name=My+New+Ad" \
https://graph.facebook.com/v2.12/{adgroup-id}/
You can update an Ad by making a POST request to /{ad_id}
.
You may perform a POST request to the following edge from this node:
#Deleting #Deleting an ad
#You can remove values for any optional fields by updating the value to empty.
#You cannot delete ads in ad set with creative_sequence settings.
curl \
-F "status=DELETED" \
-F "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<AD_ID>"
You can delete an Ad by making a DELETE request to /{ad_id}
.
You may perform a DELETE request to the following edge from this node:
facebook api之Ad的更多相关文章
- facebook api之Ads Insights API
The Ads Insights API provides API access for reporting and analytics purposes. When exclusively usin ...
- facebook api介绍
转自(http://sls.weco.net/node/10773) 一.Facebook API 基礎概念 Facebook API 概論 : API 最大的好處在於可以讓程式開發人員只需要根據 A ...
- facebook api & oauth protocal
http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-10.5 http://stackoverflow.com/questions/14 ...
- Facebook API 入门
Facebook 商业价值简介 Facebook 是一个社交网络服务网站,于 2004 年 2 月 4 日上线,到 2010 年 2 月 2 日, Facebook 正赶超雅虎将成为全球第三大网站,与 ...
- facebook api之基本概念(中文)
Facebook广告API系列 1 Facebook Graph API Facebook提供了一套类rest的接口,统称为Graph API.为啥叫Graph?因为facebook把所有的资源都抽象 ...
- facebook api之Access Tokens之Business Manager System User
Business Manager System User Make programatic, automated actions on ad objects or Pages, or do progr ...
- facebook api之Access and Authentication
Access and Authentication There are three access levels to the Marketing APIs. You can upgrade acces ...
- facebook api之Marketing API
General information on the Marketing APIs, access, versioning and more. The main use cases for the M ...
- facebook api之Business Manager API
Business-scoped Users - The new user is tied to a particular business and has permissions scoped to ...
随机推荐
- springboot报错Whitelabel Error Page
第一次使用springboot没有问题.隔了两天继续看.一直报错Whitelabel Error Page. 重新搭建试了任何方法都错了. 报的就是一个404错误,犯了一个习惯性错误,一般都是loca ...
- redis启动
在redis的安装目录的bin目录下: 1.启动服务(指定配置文件) ./redis-server redis.conf 2.启动客户端 ./redis-cli
- AI赌神称霸德扑的秘密,刚刚被《科学》“曝光”了
AI赌神称霸德扑的秘密,刚刚被<科学>“曝光”了 称霸德州扑克赛场的赌神Libratus,是今年最瞩目的AI明星之一. 刚刚,<科学>最新发布的预印版论文,详细解读了AI赌神背 ...
- pyspider源码解读--调度器scheduler.py
pyspider源码解读--调度器scheduler.py scheduler.py首先从pyspider的根目录下找到/pyspider/scheduler/scheduler.py其中定义了四个类 ...
- 几种线程安全的Map解析
转载自 面试必问-几种线程安全的Map解析 HashMap线程安全的吗? Java中平时用的最多的Map集合就是HashMap了,它是线程不安全的. 看下面两个场景: 1.当用在方法内的局部变量时,局 ...
- Codeforces 237A - Free Cash
题目链接:http://codeforces.com/problemset/problem/237/A Valera runs a 24/7 fast food cafe. He magically ...
- Jmeter压力测试和接口测试
jmeter是apache公司基于java开发的一款开源压力测试工具,体积小,功能全,使用方便,是一个比较轻量级的测试工具,使用起来非常简单.因为jmeter是java开发的,所以运行的时候必须先要安 ...
- linux的错误码error
在程序出错时,我们通过全局变量错误号errno和perror函数能够很快的定位到错误原因. Linux错误代码及其含义 C Name Value Description 含义Success 0 Suc ...
- 前端框架VUE----指令
一.什么是VUE? 它是构建用户界面的JavaScript框架(让它自动生成js,css,html等) 二.怎么使用VUE? 1.引入vue.js 2.展示HTML <div id=" ...
- jquery easyui datagrid 空白条处理 自适应宽高 格式化函数formmater 初始化时会报错 cannot read property 'width'||'length' of null|undefined
1---表格定义好之后右侧可能会有一个空白条 这个空白条是留给滚动条的,当表格中的一页的数据在页面中不能全显示时会自动出现滚动条,网上有很多事要改源码才可以修改这个,但是当项目中多处用到时,有的需要滚 ...