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 ...
随机推荐
- [openjudge-动态规划]买书
题目描述 描述 小明手里有n元钱全部用来买书,书的价格为10元,20元,50元,100元.问小明有多少种买书方案?(每种书可购买多本) 输入 一个整数 n,代表总共钱数.(0 <= n < ...
- Spark学习之路 (五)Spark伪分布式安装
一.JDK的安装 JDK使用root用户安装 1.1 上传安装包并解压 [root@hadoop1 soft]# tar -zxvf jdk-8u73-linux-x64.tar.gz -C /usr ...
- python 什么是位置参数?
位置参数是必选参数 ----不能不传, ----不能传一部分, ---必须按顺序传 ----必须传全部参数
- read 命令详解
read 命令从标准输入中读取一行,并把输入行的每个字段的值指定给 shell 变量 语法选项 -p read –p “提示语句”,则屏幕就会输出提示语句,等待输入,并将输入存储在REPLY中 -n ...
- 第一周java测验感想
在正式开学的第一周,建民老师就给我们来了一个下马威.我本身的编程基础比较差,不知道怎么去想,怎么去一步步的去完成这么一个工程.所以我在星期四的下午十分的痛苦…因为不知道怎么搞嘛.尽管在暑假的时候看了 ...
- 使用 ffmpeg 转换视频格式
ffmpeg 是 *nix 系统下最流行的音视频处理库,功能强大,并且提供了丰富的终端命令,实是日常视频处理的一大利器! 实例 flac 格式转 mp3 音频格式转换非常简单: ffmpeg -i i ...
- zabbix实现电话、短信、邮件报警
该报警方式提前说明:(1)该方式可以实现zabbix免费电话报警以及微信.短信.邮件报警,但有数量限制.详见如下:如数量不能满足需要以及人员需要,可以考虑购买收费版.(2)毕竟是免费版,电话通知要省着 ...
- struts2 + spring + mybatis 框架整合详细介绍
struts2 + spring + mybatis 框架整合详细介绍 参考地址: https://blog.csdn.net/qq_22028771/article/details/5149898 ...
- sqlalchemy多对多查询
# coding:utf-8 from sqlalchemy import create_engine, Column, String, Integer, ForeignKey, Table from ...
- js增加、删除、替换DOM对象
当网页被加载时,浏览器会创建页面的文档对象模型DOM,即Document Object Model 整个文档为一个文档节点(document对象) 每个html元素为一个元素节点(element对象) ...