I am using the standard API provided by Facebook.
A response looks something like the following for an unsuccessful transaction
{
"error": {
"message": "Error validating access token: Session has expired at unix
time SOME_TIME. The current unix time is SOME_TIME.",
"type": "OAuthException",
"code": 190
"error_subcode": 463
}
and a succesful one ssomething like
{"id":"100054544144330556_25940175479504"}
How do I detect a successful transaction? do I have to parse and see if it contains the word “error” or is there a better way?
Facebook SDK will throw an error if finds ‘error’ in the result. If you are using standard API, then you have to do the same.
For example, in Facebook PHP SDK you can see this (In a easy readable way, this is not 100% PHP):
Just do the same. But don’t forget to parse JSON object before, don’t search as a string, search as a key->value pair if there’s an ‘error’ key.