1

Closed

POST to /likes only works after GET

description

Filing issue based on discussions on Stackoverflow (http://facebook.stackoverflow.com/questions/8875134/post-to-likes-only-works-after-get-bug-or-by-design and http://facebook.stackoverflow.com/questions/8887113/facebook-c-sharp-sdk-recommend-post-using-access-token):

My app has permissions to "like" something on FB on a user's behalf. Using the Facebook C# SDK (5.4.1), here's what I wrote:

Facebook.FacebookClient fb = new Facebook.FacebookClient(AccessToken);
object o = fb.Get("1234567890_12345678901234567/likes");
dynamic parameters = new ExpandoObject();
dynamic success = fb.Post("1234567890_12345678901234567/likes", parameters);

The second line is superfluous and creates an unnecessary round-trip, as we're not interested in the other "likes" on the same object. However, without it, fb.Post fails and throws "The remote server returned an error: (400) Bad Request."

Is this a bug in the C# SDK, or a bug in the graph API, or is it by design?

Note that it's possible to POST to /comments without a previous GET.
Closed Feb 6, 2012 at 6:33 PM by ntotten

comments