samedi 18 avril 2015

I want users to like certain posts they are looking that. To do that I call <id>/likes as a POST-method.


The user has these permissions: basic_info, public_profile, publish_actions, read_custom_friendlists, user_friends, user_photos, user_posts


I load the posts using /feed/me, which should mean that Facebook will find those posts using their ids in subsequent calls.


The traffic to likes looks like this:



POST /v2.3/123456789012345_987654321098765/likes HTTP/1.1
Accept-Encoding: gzip
Authorization: Bearer blahblah...
User-Agent: Google-HTTP-Java-Client/1.11.0-beta (gzip)
Content-Length: 0
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Host: graph.facebook.com
Connection: Keep-Alive

HTTP/1.1 400 Bad Request
Content-Type: text/javascript; charset=UTF-8
WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "(#100) Error finding the requested story"
Access-Control-Allow-Origin: *
X-FB-Rev: 1694181
Pragma: no-cache
Cache-Control: no-store
Facebook-API-Version: v2.3
Expires: Sat, 01 Jan 2000 00:00:00 GMT
X-FB-Debug: Ttvq+Mie2nN3jFdxREVlQj9pbZKanHPBUdlgNnOicrpDtOvEsrPOtoaKuQ+3w7TcG2L4lbWOLKhuDh4Zm14jlw==
Date: Fri, 17 Apr 2015 07:55:08 GMT
Connection: keep-alive
Content-Length: 99

{"error":{"message":"(#100) Error finding the requested story","type":"OAuthException","code":100}}"


I tried to make it work with Graph API Explorer. I added permission user_likes, but that didn't make it work. I added permission read_stream and suddenly it worked!


However, according to the documentation the user only needs publish_actions to like a post.


As we won't get read_stream we are stuck with what the documentation offers. Is this a bug or do we need other permissions or a different logic to make it work?


Aucun commentaire:

Enregistrer un commentaire