Facebook error: "(#100) Invalid parameter", "OAuthException", "code":100 - facebook

In my messenger platform app, when I make this request:
GET https://graph.facebook.com/v2.8/${psid}?access_token=PAGE_ACCESS_TOKEN
(to get users public info based on their PSID), sometimes Facebook returns this error:
'There is an error when trying to get the user\'s info from Messenger:\nError: failed [400] {"error":{"message":"(#100) Invalid parameter","type":"OAuthException","code":100,"fbtrace_id":"FpUUkuX0egc"}}'
I have no idea why this happens, because when I saw the error then I manually made the same request (by using POSTMAN), I got the correct result (user public profile) with no error.

Maybe you can check if POSTMAN is sending something in the headers in a different way that you are doing. It happened to me something similar and it was that POSTMAN was "correcting" something.
Compare the request from POSTMAN and the one you are doing with your app side by side.
If that doesn't work, let me know and I'll look into another option. :)

Related

Twitter API returns Error 401 (using OAuthSwift)

I'm trying to access Twitter API and getting Error 401. Any idea what I'm doing wrong here? OAuth URL Callback is successful and I get aouth_token and oauth_secret as well. But when I try to access the API, I'm getting 401 in Postman. Thank you in advance.
1. consumer_key
2. consumer_secret
3. oauth_token
4. oauth_token_secret
Attaching postman screenshot.
Twitter API 401 Error in Postman
I believe you are missing some of the required codes. Do you have access_token and
access_token_secret? I have 4 access codes in total, it looks to me like you only got 2.
Error 400 means that the request was invalid or cannot be otherwise served. Requests without authentication are considered invalid and will yield this response. Is there an accompanying error message explaining the error?
Check your app settings to see if you have those other codes! Hope this helps!

HTTP Error 400: Bad Request on getting the facebook's post likes in python

I wrote the code of getting the Facebook's post data about 8 months ago, was working fine but now I run the code and I am getting
the exception of
HTTP Error 400: Bad Request.
It is on getting the likes of a post. The link is
https://graph.facebook.com/https://www.facebook.com/143462899029472_1786215864754159 fields=likes.limit(0).summary(true)&access_token=*************UmG4GyioZATAGkzXSP5k7IxqsRCpIBxhD5EvNxHAwuZAOIp3ksLWTZA0yMgvEuST1oHBNfgSZCCcYG0vZAqNitdSNoIObWagZC8oZATOfYVmBldQWjayZA0fv7zrCZAvlsGymC2w5vKzETUJiogzSIQoKAzy2UTJJ4UUmmGPKEZD
On manually accessing the link in browser it is giving;
{
"error": {
"message": "(#100) Tried accessing nonexisting field (likes) on node type (URL)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Bj6UP6k1Mu2"
}
}
Any help? Why it is so?
Why it is so?
Because they make changes to the API. You did not specify an API version in your API call, so it will fall back to the lowest one your app can use. And when that gets shut of, it moves to the next version, and so on.
But your approach was rather convoluted to begin with. This is a post on Facebook, so why treat it as an external URL?
All you need to do is make a request using the post id - then you can request the likes for that post directly.
https://developers.facebook.com/tools/explorer?method=GET&path=143462899029472_1786215864754159%3Ffields%3Dlikes.limit(0).summary(1)&version=v2.8
The problem is resolved. My bad. I use the link https://graph.facebook.com/https://www.facebook.com/143462899029472_1786215864754159 fields=likes.limit(0).summary(true)&access_token=.....
Notice in the link https://graph.facebook.com/ and then unfortunately https://www.facebook.com/ in one link.
The problem is resolved by using only https://graph.facebook.com/143462899029472_1786215864754159 fields=likes.limit(0).summary(true)&access_token=.....

Unable to run Chatter api ios sample

I am looking for some samples which I can use to post/retrieve feeds to/from groups in sales force chatter. While googling I have come across Chatter REST API in conjunction with RestKit. I was unable to run this sample which i have downloaded from github
https://github.com/cseymourSF/Chatter-API-iOS-Sample
After running the code i am able to login to sales force via application. But for the below
Request :
Sending asynchronous GET request to URL ///services/data/v23.0/chatter/users/userId.
(ex:///services/data/v23.0/chatter/users/me)
Error:
User fetch failed with error: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo=0xa58ffa0 {NSErrorFailingURLStringKey=///services/data/v23.0/chatter/users/userId, NSErrorFailingURLKey=///services/data/v23.0/chatter/users/userId, NSLocalizedDescription=unsupported URL, NSUnderlyingError=0xa5906d0 "unsupported URL"}
and the current url i am suing is below:
https://na15.salesforce.com/services/data/v23.0/chatter/users/me
any help could be appreciated.
It seems like REST API wrong method invocation

"(#100) object URL is not properly formatted" while trying to setup facebook subscription

I am trying to setup facebook subscriptions for checkins, I have already asked for the user_checkins permission in my app, so I issue the following url
https://graph.facebook.com//subscriptions?access_token=&object=user&callback_url=&verity_token=&fields=checkin
To which I get
"(#100) object URL is not properly formatted"
The access token is valid, the url is properly encoded and points to a page according to FB guidelines about hub.xxx, everything seems normal. I am doing a GET though. Could this be the problem? Should it be a POST as the docs? Or is there another issue?
Thanks
Yes, this request should be POST (or GET with method=post argument passed). And this exactly the error message returned if you fail to do so...

What is Twitter's duplicate tweet error code?

In my iphone app i am using Twitter-OAuth-iPhone to post and retrieve data from Twitter. The problem is that when someone wants to post a tweet twice(maybe by mistake) i need to tell him that the tweet was already posted.
when i do this i receive a 403 error from Twitter:
request failed with error Error
Domain=HTTP Code=403 "The operation
couldn’t be completed. (HTTP error
403.)"
the message doesn't tell me that i tried to post a duplicate Tweet. The 403 code, as specified here, is used when requests are being denied due to update limits.
A solution that i thought of is to keep in my app a list of tweets that where posted (an archive) that will be checked every time a new tweet is sent. The problem with this solution is that if someone is updating his twitter status from the web or other app it will fail because the archive from my app will not be updated.
I found a comment that says that the 403 code is just for duplicate tweets, but the documentation says otherwise.
EDIT:
on https://github.com/mattgemmell/MGTwitterEngine it says that:
In these cases you'll receive a call
to requestFailed:withError: which will
include an NSError object detailing
the error. Twitter usually returns
meaningful HTTP error codes (like 404
for 'user not found', etc), and in
that case the -domain of the NSError
will be "HTTP" and the -code will be
the relevant HTTP status code. The
userInfo of the NSError will contain a
key "body" that may contain the
response body and "response" which
will contain the NSHTTPURLResponse.
This makes it really, really easy to
know what's happening with your
connections.
but the userInfo attribute of the NSError that i receive in my app is null.
The problem is that Twitter-OAuth-iPhone for 4xx responses does not return the response body.
A solution could be to modify the MGTwitterEngine to provide the full error message. An example can be found here.