如何通过Facebook上的广告API获取广告系列列表? [英] How do I get the campaigns list through the ads API on Facebook?

查看:2473
本文介绍了如何通过Facebook上的广告API获取广告系列列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Graph API Explorer获取广告系列列表。我正在使用 https://developers.facebook.com/docs/marketing-api/reference/ad-account/campaigns/ 发现的请求。

  GET /v2.8/{ad-account-id}/campaigns HTTP / 1.1 
主机:graph.facebook.com

我是用于广告的页面的业务经理和管理员。我在Graph API资源管理器中使用以下请求找到了 AD_ACCOUNT_IDs

  GET /v2.8/me/businesses HTTP / 1.1 
主机:graph.facebook.com





提交广告系列的第一个请求时报告的错误是:

  {
error:{
message:不支持的获取请求。ID为1015359838XXXXXX的对象不存在,无法加载由于缺少权限,或者不支持此操作,请阅读https API文档https://developers.facebook.com/docs/graph-api,
type:GraphMethodException,
code:100,
fbtrace_id:DLyfwGbM8fi
}
}

有什么问题?



提前感谢,



Mattia

解决方案

我同样是havin g / p>

我已经能够通过ID检索广告系列数据,所以我显然

em>已经有权限



但是Facebook的错误消息是误导的。



检索广告帐户时(为了显示它的广告系列或任何您想要的内容),您需要检索其ID前面加上act _。



例如,您可以要求 / act_123456789000001234 / campaign 而不是 / 123456789000001234 / campaigns



非常感谢@Jan Sommer在 https://stackoverflow.com / a / 39974857/470749


I am trying to get the campaigns list from the Graph API Explorer. I'm using the request found at https://developers.facebook.com/docs/marketing-api/reference/ad-account/campaigns/.

GET /v2.8/{ad-account-id}/campaigns HTTP/1.1
Host: graph.facebook.com

I'm' business manager and admin of the page used for ads. I found the AD_ACCOUNT_IDs using the following request on the Graph API Explorer.

GET /v2.8/me/businesses HTTP/1.1
Host: graph.facebook.com

I choosed the one which had the higher privileges.

The error reported when submitting the first request for campaigns is:

{
    "error": {
        "message": "Unsupported get request. Object with ID '1015359838XXXXXX' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
        "type": "GraphMethodException",
        "code": 100,
        "fbtrace_id": "DLyfwGbM8fi"
    }
}

What's wrong?

Thanks in advance,

Mattia

解决方案

I similarly was having problems trying to retrieve a list of all campaign IDs within an ad account.

I already am able to retrieve campaign data by ID, so I obviously have permissions already.

But the Facebook error message is misleading.

When retrieving an ad account (in order to then display its campaigns or whatever you want within it), you need to retrieve by its ID prepended with 'act_'.

E.g you could request /act_123456789000001234/campaigns instead of /123456789000001234/campaigns.

Thanks so much to @Jan Sommer at https://stackoverflow.com/a/39974857/470749.

这篇关于如何通过Facebook上的广告API获取广告系列列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆