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.Answer1:
Yes, it should be possible to do post commands without a get. Strangely enough, my like code with the 5.4.1 does not require the extra GET directly before the POST for doing a like. Maybe somewhere else in my app's flow I've already done some sort of GET via the API. However, I'm going to investigate my DELETE problem with
me/permissions that I'm encountering (http://stackoverflow.com/questions/8598614/facebook-c-sharp-api-return-400-when-deauthorizing-app) and see if a get to the me/permissions first will help resolve that issue.