I have 2 test users in facebook.
I want to make them friends using Facebook Graph API:
https://graph.facebook.com/v2.6/user1_id/friends/user2_id?access_token=user1_access_token
method: post
I get error:
{
"error": {
"message": "(#33) This object does not exist or does not support this action",
"type": "OAuthException",
"code": 33,
"fbtrace_id": "A7EHydY_B4x......."
}
}
Can someone please help?
Thanks.
https://developers.facebook.com/docs/graph-api/reference/v6.0/test-user:
An app access token is required to update these fields for any test users associated with that app.
You need to use your app access token for this, not a user token.
Related
First I auth my user, which has role instagram Test Users, got access token by doint request to https://api.instagram.com/oauth/access_token Follow Getting Started guide.
Make a request to get user data https://graph.instagram.com/me?fields=username&access_token={{ACCESS_TOKEN}}
Everything OK, got 200 status and data.
Now tried to follow API Stories Docs
make a request to: https://graph.facebook.com/{{IG_ID}}/stories?access_token={{ACCESS_TOKEN}} (IG_ID is the ID I got from user data request) but doesn't work return invalid access token
{
"error": {
"message": "Invalid OAuth access token - Cannot parse access token",
"type": "OAuthException",
"code": 190,
"fbtrace_id": "{ID}" //im not sure if important to hide
}
}
Now tried to use Explorer Api Graph (Tools->Explorer) I generate an access token (this token is generated with Facebook, not instagram), use this token and the ID (/me in Explorer API) in previous request and the response is:
//https://graph.facebook.com/{{ID}}/stories?access_token={{TOKEN}}
{
"error": {
"message": "(#100) Tried accessing nonexisting field (stories) on node type (User)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "{ID}"
}
}
Maybe I'm misunderstanding the guide, anyone have worked with API?
Hmmm... Does API works with private/public accounts? Or only if account is Business/Content Creator might use this?
Can I get the access token without login? As I need to get the ratings by below API and this API i required access_token.
https://graph.facebook.com/v5.0/{page-Id}/ratings?access_token={page_access_token}
Below steps I have done it to achieve the ratings.
First API Call
https://graph.facebook.com/oauth/access_token?client_id={client-id}&client_secret={client-
secret-id}&grant_type=client_credentials
Second API calls
https://graph.facebook.com/debug_token?input_token={user_access_toke}
&access_token={generated_access_token_from_ouath}
Error:
{
"error": {
"message": "(#100) The App_id in the input_token did not match the Viewing App",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AFBYAMTvW5W65Ur3gUXa_0e"
}
}
Can you please help me out to generate the access token so I can get the rating and reviews.
For Ratings, you need to use a Page Token. A Page Token can only be generated with a User Token, and you do need to login for that. Without any login, Facebook does not know if you own the Page - which is required to read the Ratings with the API.
Information about Tokens and how to generate them:
https://developers.facebook.com/docs/facebook-login/access-tokens/
https://www.devils-heaven.com/facebook-access-tokens/
At a facebook page, where i am not an admin, subscribed to my facebook app, which is a chatbot. Altough the chatbot functioning already, i cannot setup the get_started button with the following call:
https://graph.facebook.com/v5.0/me/messenger_profile?access_token=theaccesstoken
{
"get_started":{
"payload":"GET_STARTED_PAYLOAD"
}
}
it works for the pages i am admin of, but for this page i get the following response:
"error": {
"message": "(#200) User does not have sufficient administrative permission for this action on this page. If the page business requires Two Factor Authentication, the user also needs to enable Two Factor Authentication.",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "44323423423423"
}
}
the access token has the followiing permissions for the page:
email, manage_pages, pages_show_list, read_page_mailboxes, pages_messaging, public_profile
the token did not expire
Can some explain please what should be done differently?
[UPDATE]
The problem occured because the user was not a page admin, just an editor.
I'm using postman to query from Facebook Graph API. I'm trying next line:
https://graph.facebook.com/v2.8/me?access_token=my_access_token=<here is my user token>
and i get:
{
"error": {
"message": "Invalid OAuth access token.",
"type": "OAuthException",
"code": 190,
"fbtrace_id": "ASBwgp9xF/R"
}
}
I can't figure out alone the right syntax
the access token works at facebook graph api explorer.
You donĀ“t even need postman for this, just hit the URL in your browser.
This is the correct one:
https://graph.facebook.com/v2.8/me?access_token=<here is my user token>
My app have been approved for publish_actions permission and I want to publish to user's wall behave my user. I tried to call the graph API like this:
https://graph.facebook.com/v2.7/me/feed?access_token=<token>&method=post&message=Hello
I read the facebook documents and It says A user access token with publish_actions permission can be used to publish new posts.
But actually I can't publish the message to user's wall. What I receive is:
{
"error": {
"message": "Invalid OAuth 2.0 Access Token",
"type": "FacebookApiException",
"code": 190,
"error_subcode": 1732004,
"is_transient": false,
"error_user_title": "Invalid Access Token",
"error_user_msg": "Invalid access token received.",
"fbtrace_id": "<trace code here>"
}
}
Do I make any mistake?
Update: Add screenshot of my token debugger information
This worked fine for me: https://graph.facebook.com/me/feed?access_token=xxx&method=post&message=test
Make sure the Access Token is valid and includes the publish_actions permission, you can test it here: https://developers.facebook.com/tools/debug/access_token/