facebook unsupported post request

只谈情不闲聊 提交于 2019-12-12 03:36:41

问题


I have logged in a user to my app from FB.login now I want to post to the user timeline on the behalf of user. I want to upload a video to the user timeline. I am doing something like:

FB.api(
    `/${user_id}/videos`,
    "POST",
    {
        "file_url": video,
        "description": description,
        "thumb": video_thumbnail,
        "title": title,


    },
    function (response) {
      console.log("fb response")
      console.log(response)
      if (response && !response.error) {
        /* handle the result */
        console.log("video upload response")
        console.log(response)
      }
    }, {scope: ['user_videos', 'user_actions.video']});

When I do this it is giving me error saying code: 100 fbtrace_id: "F1BDJWtcTXl" message: "Unsupported post request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api" type: "GraphMethodException"

Why I am getting this error ??

Help is appriciated ..

Thank you


回答1:


Use /me/videos instead of /${user_id}/videos and use single (or double) quotes instead of "`".

Also, you need publish_actions only, and you need to use the scope parameter with FB.login. FB.api is just an API call.

Here´s an example for the login: http://www.devils-heaven.com/facebook-javascript-sdk-login/

And here´s the link to the docs for uploading videos: https://developers.facebook.com/docs/graph-api/reference/user/videos/#Creating

Someone suggested that the App may be in sandbox/dev mode, no sure why this should be a problem but here´s the thread: How to fix "Unsupported post request" when posting to FB fan page?



来源:https://stackoverflow.com/questions/35744180/facebook-unsupported-post-request

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