It seems Facebook is preventing search of a specific term.
As part of a site we are launching, had planned to query Facebook for the term #bestsummerever.
So the request to Graph API using an app access token for public data is the form:
/search/?q=%23bestsummerever
This now gives me the following error:
OAuthException
An unexpected error has occurred. Please retry your request later.
The error is new sometime between last week and this week.
I can query other "hashtags" with no issue, all of the following work:
/search/?q=%23bestsummereve
/search/?q=%23bestsummereverr
/search/?q=%23bestsummer
So it seems like I am strictly being prevented from querying #bestsummerever. This seems to be consistent regardless of what app I make the request with.
There does not seem to be any documented reason for this issue.
Can be reproduced using any app access token on the Facebook Graph Explorer. Really hoping this is some kind of small oversight on my part, but seems more like Facebook has some kind of restriction on that specific term.
First of all, Facebook requires that you provide an User Access Token if you search for obejcts other than places and pages (see https://developers.facebook.com/docs/graph-api/using-graph-api#search).
Apparently there IS some strange behaviour with your desired hashtag:
GET /search?q=%23selfie&type=post
works fine, whereas
GET /search?q=%23bestsummerever&type=post
produces an error. But
GET /search?q=bestsummerever&type=post
works for me. Strange, but maybe you can go on without the hashtag for now.
Related
I'm using the LinkedIn api and would like to access companies but I'm running into a vague error that I haven't been able to figure out.
I'm using php and the php libracy 'Happyr\LinkedIn\LinkedIn' to access the API. My current application also has the 'rw_company_admin' permission attached to it.
When I make a call to the api endpoint '/v1/people/~:(id,first-name,last-name)', I get the correct response.
But when I make a call to the '/v1/companies?format=json&is-company-admin=true' endpoint I get the following error:
"Invalid company query request"
When I perform the exact same query in the LinkedIn Rest Console, I get the response I'm looking for. Any ideas?
Figured it out after hours of debugging.
The issue will probably be specific to the php package mentioned in the question. The LinkedIn library in use was automatically appending 'format=json' to the query call which sparked an error.
By removing the default output setting in the library, the call worked fine.
In my case, it was related to permissions of the application.
If you want to retrieve company list of the user, you should check rw_company_admin permission in the settings page of the application or give it to scope parameter. Then, you should get a new access token and make requests with it.
I've been using the Facebook php sdk to interact with facebook quite successfully. When I tried to create a photo album the code created a duplicate. At first I thought it was the php sdk (using 3.x). I tried switching to Perl with LWP::UserAgent and LWP::Simple::Post to use the http url for graph. Nothing is working. Every way I try I get double albums when I call the code. I've ensured that the code is being called once (mainly because I've created a super small test script to do it and have made outputs to ensure on the command line that it's only calling once.
Here's the url I'm using:
https://graph.facebook.com/me/albums?access_token=<access_token>&name=Test+Album+2&message=Test+Description
I've taken off the privacy setting from the url and it hasn't changed the behavior. If I run this directly in the graph explorer, it creates only one album. But any other method (yes, I am using POST and not GET and yes I've tried to pass all the params as post data individually rather than via querystring, either way results in duplicate albums) causes duplicate albums.
Has anyone experienced this? How do I fix it??? I'm at my wits end trying to figure this out.
I've tried it on multiple servers in thoughts that perhaps one of them was using a proxy causing the duplicate call, but whether I run it on my hosting service or on my localhost, I still get duplicates.
No matter what I've tried, if I am creating the album via code in PHP or Perl I get double albums created. HELP!
My first answer was deleted for some reason so I'm not sure what to do at this point. This question can't be answered because:
The issue was not with the SDK but with Facebook itself. I had created a bug report after doing some more tests. Facebook confirmed and fixed the bug. Basically, it had to do with inappropriate permissions handling.
https://developers.facebook.com/bugs/1435856773345641/
There was a bug in Facebook's handling in this instance. I'm hoping this answer doesn't get deleted because someone else may experience this and want to know that it was a bug in Facebook code, not in the PHP SDK or in the user code.
Not sure why Andrew Barber would delete that answer.
Unless someone has a better answer than what Facebook gave to me via bug report follow-up.
I've been visiting this forum for years, but this is my first ever question. Any help would be appreciated!
I am writing a web service to pass groups from one application into Facebook and invite the authorised people into them and set a nice pretty cover photo that is generated and stored within the application.
The group creation works splendidly after a fair old bit of head scratching, however, when I try to set the cover image, I am getting a rather useful error message back as below.
OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
It's a PHP application on Code Igniter. According to Facebook's delightfully accurate API documentation, this is a simple matter of a cUrl post to 'graph.facebook.com/$groupId' passing the same auth token I just used to create the group and perform the invites and a single JSON encoded parameter of 'cover_url' => $urlOfImage .
A simple task in theory, however, I have spent all day today and a significant chunk of yesterday trying to get this to work without much success.
I have tried posting the image as a Curl object as is necessary in other areas of the Facebook API, and it appears to be trying giving me an error that the image is generating a 404 error (it isn't, when I checked the access logs, it was never requested).
Please be someone out there who has had some success with this.
This has now been fixed by Facebook
So I'm trying to get the latest tweets posted by a user using a PHP script (and caching the results into a text file). I'm using the request https://api.twitter.com/1/statuses/user_timeline.json?count=5&screen_name=google and it's been working fine as a public client, but in order to get better control over my API hit limit I need to authenticate my requests.
I've tried the method shown at https://dev.twitter.com/docs/auth/application-only-auth , but after I successfully connect I get the error "Your credentials do not allow access to this resource" (why ?). So I've tried to use the OAuth method (which looks frighteningly complicated for a hobbyist like me), and downloaded the TwitterOAuth library. But I'm still having trouble connecting ! I put my credentials in the config.php file, but I have no idea where to go from there. The documentation seems to be hinting that I need to manually login to Twitter to authorize the application's connection token... or something. Apparently I need to redirect to some callback URL (what even ?!) and get a short-term connection to enable a long-term connection password which I have to store for later ? What is this madness ?
I was initially under the impression that I could just fetch data from Twitter's RSS feeds but those can't be accessed from scripts for some reason (unlike the Google News RSS feed which fetches just fine). It seems I've gotten myself into something much more complicated than what I signed for. Isn't there an easier (and saner) way of doing this ? Or is nothing decidedly simple ?
I apologize for being such an easily-confused dullard, but my head is spinning.
Thanks !
Edit : after digging around some more I decided to just use PHP curl to fetch the raw page, and then do some Xpath voodoo to get the tweets and the time they were posted at. Of course, this is CPU-intensive, far from stable, and probably not a practice that pleases the folks at Twitter; it also only returns the last 20 tweets (which is thankfully enough for my needs).
However, Cormac Driver's response below about Temboo is certainly a method I'll be investigating next time I need to do something like that.
Temboo provides a simple way of using OAuth to authenticate with Twitter. The process is broken down into two steps:
InitializeOauth. This step returns a Twitter authorization URL that Twitter account holders can visit to grant access to your script.
FinalizeOauth. This step returns the access token that your script will need to make authenticated requests to the Twitter API on behalf of the user.
Full details on how to do this with PHP here: https://www.temboo.com/library/Library/Twitter/OAuth/
You can see an example of how Temboo handles OAuth for Facebook on this page. The PHP source code is provided, and it's almost identical to the code you'll need to do the same thing for Twitter.
(Full disclosure: I work at Temboo)
I'm using Facebook's PHP SDK, and it's been great so far. However, I have a weird issue on one page. On this page, I make a call to the graph API, then later a call using FQL. On the second call, however, I get an "Invalid OAuth 2.0 Access Token" exception. Why would the token become invalid while the first call worked? I also use FQL (same exact query/code) elsewhere in my site, and it works just fine. Does anyone know what would cause this?
Update: First call is a graph call (/me?fields=email).. second is querying for current user's affiliation, if that helps.
Could be one of several things, but if I had to hazard a guess, I'd say that you're trying to access something out-of-session, and your oauth token doesn't include the offline_access permission for the resource being accessed.
Perhaps some more detail about the nature of your API calls/FQL queries would help us narrow it down.