使用Facebook v2.1 Graph API以cURL方式编制测试用户 [英] Programatically creating Test Users with cURL using the Facebook v2.1 Graph API
问题描述
我一直在查看HTTP Facebook Graph API v2.1的API文档:
https://developers.facebook.com/docs/graph-api/reference/v2.1/app/accounts/test-users
关于发布的部分让我相信我应该有足够的权限,只需使用我的app-access-token来编程测试用户:
- 需要一个应用访问令牌来为该应用创建新的测试用户。
所以我试图形成一个这样的请求:
curl -v --data name = foo& access_token = xxxxxxxxxxxxxxxxxhttps://graph.facebook.com/v2.1/99999999999999/accounts/test-users
我正在使用access_token是我的应用程序令牌,如该页面所示:
https://developers.facebook.com/tools/accesstoken/
几乎可以工作。确实创建了一个新用户 foo
,即使在Facebook App Developer页面的测试用户部分显示了 foo
。但是,请求一直产生一个奇怪的响应:
HTTP / 1.1 500内部服务器错误
< WWW-Authenticate:OAuthFacebook Platformunknown_error发生未知错误。
< Facebook-API版本:v2.1
< ...
{error:{message:发生未知错误,type:OAuthException,code:1}}
我在Stack Overflow上查看了一些类似问题的老帖子,但是在尝试了这些线程中的建议之后我仍然面临同样的问题,我怀疑这些线程中的建议是针对较旧版本的Facebook Graph API。
有人可以解释发生什么问题吗?这是我应该能够从cURL做的,而不是自己登录到Facebook?
我没有修复,但我有一些新的数据。
这个开始发生在我昨天2014-10-14,有时上午10点到12点PDT。代码和一个以前工作的FB应用程序停止工作,今天仍然存在。
令人惊讶的是,当我看着 https://developers.facebook.com/apps/FB_APP_ID/roles/test-users/ ,我可以看到新用户。
所以调用是正在创建新用户的工作,但是我们得到一个500 code = 1 message =An未知错误发生。
I want to programatically create Facebook Test Users for my Facebook App.
I've been looking at the API docs for the HTTP Facebook Graph API v2.1:
https://developers.facebook.com/docs/graph-api/reference/v2.1/app/accounts/test-users
The section about publishing has led me to believe that I should have adequate permissions to create Test Users programatically with just my app-access-token:
- An app access token is required to create new test users for that app.
So I've tried forming a request like this:
curl -v --data "name=foo&access_token=xxxxxxxxxxxxxxxxx" https://graph.facebook.com/v2.1/99999999999999/accounts/test-users
The access_token I am using is my 'App Token' as shown on this page:
https://developers.facebook.com/tools/accesstoken/
It almost works. A new user foo
does indeed get created, foo
even shows up in the Test Users section on the Facebook App Developer page. However, the request consistently yields a strange response:
< HTTP/1.1 500 Internal Server Error
< WWW-Authenticate: OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
< Facebook-API-Version: v2.1
< ...
{"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}}
I've taken a look at a number of older posts from users on Stack Overflow with similar problems, however, after trying the suggestions in those threads I still face the same problem, I suspect the suggestions in those threads are specific to older versions of the Facebook Graph API.
Can someone please explain what is going wrong? Is this something that I should be able to do from cURL without being logged into Facebook myself?
I don't have a fix, but I have some new data.
This started happening to me yesterday 2014-10-14, sometime between 10 AM and 12 PM PDT. Code and an FB app which had been working previously stopped working, and remains broken today.
Surprisingly, when I look at https://developers.facebook.com/apps/FB_APP_ID/roles/test-users/, I can see the new users.
So the call is "working" in that new users are being created, but it is broken in that we get a 500 code=1 message="An unknown error has occurred."
这篇关于使用Facebook v2.1 Graph API以cURL方式编制测试用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!