This API returns all ADS_POST created from ads post UI in ads manager. It can also return INLINE_CREATE posts which used to support delivered ads.
pages_manage_ads
permissionpages_show_list
permissionads_management
permissionADVERTISE
task on the Page.GET /v21.0/{page-id}/ads_posts HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{page-id}/ads_posts',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
"/{page-id}/ads_posts",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/ads_posts",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{page-id}/ads_posts"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
パラメーター | 説明 |
---|---|
exclude_dynamic_ads boolean | デフォルト値: false Exclude dynamic ad posts from the request |
include_inline_create boolean | デフォルト値: false Include also the INLINE_CREATE posts which are created to support delivered ads. |
since datetime/timestamp | The earliest timestamp of return data set |
until datetime/timestamp | The latest timestamp of return data set |
このエッジからの読み込むではJSONフォーマットの結果が返されます:
{ "
data
": [], "paging
": {}, "summary
": {} }
data
paging
summary
エッジの集計情報(数値など)。サマリーパラメータで取得するフィールドを指定します(サマリー=total_count
など)。
フィールド | 説明 |
---|---|
total_count unsigned int32 | The total number of ad posts associated with this Page |
エラー | 詳細 |
---|---|
200 | Permissions error |
80001 | There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
190 | Invalid OAuth 2.0 Access Token |
100 | Invalid parameter |
3001 | Invalid query |