POST to /likes only works after GET - bug or by design?

老子叫甜甜 提交于 2019-12-12 02:48:00

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/8875134/post-to-likes-only-works-after-get-bug-or-by-design

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!