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_idorobject_story_spec
- Objective:
- Link Ads
- Objective:
LINK_CLICKS - Creative fields:
object_story_idorobject_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_managementads_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_managementads_readmanage_pagespages_show_listbusiness_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 ...
随机推荐
- C++11 Function 使用场景
[1]场景分析 在一个函数内部,可能会多次用到某一段代码,一般情况是把这段用到次数较多的代码封装成一个函数. 但是,如果这段代码仅仅只在这个函数中有使用,这时封装成函数显得既麻烦又冗赘. 那么,有没有 ...
- weblogic 乱码
1.找到weblogic安装目录,当前项目配置的domain 2.找到bin下的setDomainEnv.cmd文件 3.打开文件,从文件最后搜索第一个set JAVA_OPTIONS=%JAVA_O ...
- ODBC数据库
ODBC数据源全称是开放数据库互连(Open Database Connectivity),在微软公司开放的数据库结构中的一部分,其实是一个应用程序的接口,主要用于提供数据库的编写应用程序的能力.
- Java注解的原理
自Java5.0版本引入注解之后,它就成为了Java平台中非常重要的一部分.开发过程中,我们也时常在应用代码中会看到诸如@Override,@Deprecated这样的注解.这篇文章中,我将向大家讲述 ...
- Linux基础命令---显示主机名hostname
hostname hostname指令用于设置或者显示系统主机名,没有任何参数就会返回gethostname()函数的返回值.使用hostname指令之后,主机名会立马被修改,但是重启系统之后就失效了 ...
- hibernate二级缓存ehcache hibernate配置详解
<!-----------------hibernate二级缓存ehcache------------------------->hibernate配置 <prop key=&quo ...
- 怎样从外网访问内网IIS?
本地安装了一个IIS,只能在局域网内访问,怎样从外网也能访问到本地的IIS呢?本文将介绍具体的实现步骤. 准备工作 安装并启动IIS 默认安装的IIS端口是80. 实现步骤 下载并解压holer软件包 ...
- 怎样从外网访问内网php-fpm?
本地安装了一个php-fpm,只能在局域网内访问,怎样从外网也能访问到本地的php-fpm呢?本文将介绍具体的实现步骤. 准备工作 安装并启动php-fpm 默认安装的php-fpm端口是9000. ...
- Tomcat启动程序端口冲突、确认相应进程及杀死冲突进程的解决方案
一. 查看所有进程占用的端口 在开始-运行-cmd,输入:netstat –ano可以查看所有进程 二.查看占用指定端口的程序(1)命令窗口输出 命令:netstat –ano | findstr & ...
- pat 团体赛练习题集 L2-007. 家庭房产
给定每个人的家庭成员和其自己名下的房产,请你统计出每个家庭的人口数.人均房产面积及房产套数. 输入格式: 输入第一行给出一个正整数N(<=1000),随后N行,每行按下列格式给出一个人的房产: ...