Friday, March 20, 2015

Making Facebook Graph Photos Api Work with url

As per the documentation on Facebook https://developers.facebook.com/docs/graph-api/reference/v2.2/user/photos/

For /photos api if we want to post a photo to user timeline, using an url on open internet then we must:

POST /v2.2/me/photos HTTP/1.1
Host: graph.facebook.com

source=%7Bimage-data%7D


But this gives:

{
  "error": {
    "message": "An unknown error has occurred.",
    "type": "OAuthException",
    "code": 1
  }
}

We should avoid adding {} or encode %7B and %7D around image-url for this to work. So correct would be:


POST /v2.2/me/photos HTTP/1.1
Host: graph.facebook.com

source=image-data

No comments:

Post a Comment

From Stubborn to Smart: How I Learned to Use AI as a PM

Listen to the article in podcast format on PM-AI Diaries channel on Spotify! Ever since I published "The Death of the Stubborn PM...