Versão Graph API

Page Ads Posts

Leitura

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.

Requirements

You will need:
  • The pages_manage_ads permission
  • The pages_show_list permission
  • The ads_management permission
  • The person requesting the access token must be able to perform the ADVERTISE task on the Page.

New Page Experience

This endpoint is supported for New Page Experience.

Exemplo

Graph API Explorer
GET /v19.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
}];
Se quiser saber como usar a Graph API, leia nosso guia sobre Como usar a Graph API.

Parâmetros

ParâmetroDescrição
exclude_dynamic_ads
boolean
Valor padrão: false

Exclude dynamic ad posts from the request

include_inline_create
boolean
Valor padrão: 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

Campos

A leitura desta borda retornará um resultado formatado em JSON:

{ "data": [], "paging": {}, "summary": {} }

data

Uma lista de nós PagePost.

paging

Para saber mais detalhes sobre paginação, consulte o Guia da Graph API.

summary

Informações agregadas sobre a borda, como contagens. Especifique os campos a serem buscados no parâmetro de resumo (como summary=total_count).

CampoDescrição
total_count
unsigned int32

The total number of ad posts associated with this Page

Error Codes

ErroDescrição
200Permissions error
80001There 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.
190Invalid OAuth 2.0 Access Token
100Invalid parameter
104Incorrect signature

Criando

Não é possível executar esta operação neste ponto de extremidade.

Atualizando

Não é possível executar esta operação neste ponto de extremidade.

Excluindo

Não é possível executar esta operação neste ponto de extremidade.