I'm trying to get a copy of my status updates on my website homepage using the Graph API, but I'm struggling to get an access code that works at all, let alone one that never expires.
I'm using the Explorer and sometimes I get an access code that works but mostly I get the following:
Any ideas what I need to do? I'm guessing I need to play around with the settings.
Related
This one is a little odd. I am making a request that has been made many times before, but for some reason is being denied. However, it is only being denied from postman/arc and from my server. If I paste it in the browser, I get the list of campaigns just like I would expect.
So this works in the browser:
https://graph.facebook.com/v2.7/act_blahblahblah/campaigns?fields=name,status,objective&access_token=mytoken
But if I try to make a request from cURL or test it in postman or arc I get this error:
Unsupported get request. Object with ID 'act_blahblahblah' 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
(Of course, I have replaced the real ad account w/ blahblahblah for this example).
The token is valid AND I made sure that the account ID is listed in advanced settings. This has worked in the past, so I'm not sure why I am getting it now. Any ideas?
It actually was a token issue, but just not one I could tell right off the bat. I am using an extended token that works, but needed to be refreshed after a change was made. So I got a fresh token, extended that, and tried it with the new extended token and it works just fine now. Just remember kids, if in doubt, get a fresh token. You too self. You too.
The graph API explorer is helpful in testing access token issues.
https://developers.facebook.com/tools/explorer/
Also, most access tokens expire quickly, and if you need a permanent token for a prod environment, i would recommend looking at system user tokens.
https://developers.facebook.com/docs/marketing-api/businessmanager/systemuser/
Is it possible to use facebook-api without making any facebook app, just from Graph api?
So that I can ask people to share there facebook profile information(public or non-public) with me given that they have control over whatever information they want to share. In graph-api, the only way I know, is to ask people to get a access token and give me.
I wanted it to be a system generated request for permission and all they had to do is just hit okay or hit cancel and depending that I get response related to access-token.
and To make a working facebook-app I atleast need to have a website or android app or something else, which I don't have it yet.
I can't think of any working way.
No, you need Access Tokens for almost all API calls, and you can only get Access Tokens with an App - no matter which Access Token.
#luschn is right that you need Access Token to API Calls. You can easily create a new app using Facebook. Once you created an app, you can generate token, which can be used to make Graph API Calls.
Helpful Links:
App Create Link https://developers.facebook.com/apps
Get Token: https://developers.facebook.com/tools/explorer?method=GET&path=comment&version=v2.11
According to the Facebook documentation, an array of posts for a page can be retrieved with any valid access token:
And indeed, using the Graph API Explorer it's possible to demonstrate this. When I copy this access token to my app (using Koala) I get the same result. So far so good.
But when I make the same request using my app access token I get an empty array.
It seems to depend on the page because for example this one doesn't display the same behavior
Any idea why this might be?
(Also, the API also seems to show a behaviour where if you specify a historical time period using 'since' & 'until' it returns more results than if no time period is specified. Can you shed any light on this? )
Clarification
The 'app access token' I am using is of the form MY_APP_ID|xXxXxXxXxXxXxXxXxXxXxXxXxXx and was generated by following the Facebook instructions on 'obtain app access token'
Take for example
http://www.facebook.com/photo.php?v=10150130077340815&set=vb.22092443056&type=2&theater
If I try and access that object in the graph explorer
https://graph.facebook.com/10150130077340815
I get an OAuthException which says I need a user token.
But if I just go to the above URL on the FB website, I can see the video just fine!
HOW can I programatically access objects like that -- where I can see when on Facebook-the-site without being logged in, but can't get at them in code without an access token?
WHat incredibly simple thing am i missing here?
You need an access token to access objects owned by other other objects when using the graph api
You can verify this by going here and trying your query... it won't work.
Then, click on "Generate access token", try the same query (for 10150130077340815) and voila, you got starbucks stuff.
Get your access token and you should be able to do this. You might have to jump through some hoops getting it renewed if this has to be a completely thing.
A while ago I had written some code that searched Facebook events using the api. I've been trying to revive that code but have been unsuccessful. The main difficulty I see is that is that searching for public events now seems to require an access token. The documentation (https://developers.facebook.com/docs/reference/api/event/) says that shouldn't be the case until July 5th but, the sample event search for me (https://graph.facebook.com/search?fields=name&q=conference&type=event) returns nothing if you don't have an access_token.
So I got an access_token for my application using the facebook php sdk $facebook->getAccessToken(). The problem I am now suffering is this seems to be the wrong type of token. It doesn't work to return any events and the query when posted into the url bar doesn't get anything, but if I switch it an access token generated by a learn graph api link the query works in the url bar (but not from my site annoyingly enough). The type of access token I'm getting from the app is basically | and that is the type that is not working for the event search.
I am basically looking for any advice I can get. How to get an access token that the event search will accept would be helpful. I also find it weird that I can do an event search using the url bar but, the exact same query through my app returns an empty array. So basically anything that can shed some light on my problems would be great.
UPDATE:
I got everything working except that it still requires a user access token rather than an app access token (or none). My other problem was caused by an oddity in the php sdk and I was able to solve it by just doing the curl queries myself.
I have the same problem, at this moment I'm using the access token the graph API explorer (https://developers.facebook.com/tools/explorer) uses when my app is selected (I think it's the users's token so the app can beave as the user, and since it's my access token it's not a big deal).
But this raise another problem: I think the token gets invalidated by logging off from FB or anything similar.