YouTube v3 API returns status code 400 for a valid request

江枫思渺然 提交于 2019-12-22 11:28:30

问题


I'm currently banging my head against the wall trying to perform a seemingly simple request to the YouTube API, using OAuth.

I can successfully request a list of comments using the comments endpoint. However, the issue comes into play when trying to delete a comment or set it's moderation status.

In the case of moderation status updates, I'm performing a POST to the following address (with a valid access token of course):

https://www.googleapis.com/youtube/v3/comments/setModerationStatus?access_token=[ACCESS_TOKEN]&id=z12cfbpgsqvcxtzpc04cgrngqt3xuhqrjmo0k&moderationStatus=rejected

The comment is on a video owned by the authenticated user, but the response I receive is:

{
 "error": {
  "errors": [
   {
    "domain": "youtube.comment",
    "reason": "processingFailure",
    "message": "Bad Request",
    "locationType": "parameter",
    "location": "id"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

The message seems to indicate that there is something wrong with the ID parameter, although I know this is a valid comment ID because I can retrieve it through the API. I also get exactly the same response when attempting to delete the same comment.

Interestingly, attempting to perform the same operation through their API explorer yields the same results.

Also worth mentioning is that the scope requested during OAUth login was: https://www.googleapis.com/auth/youtube.force-ssl. Which is the only one that works for this operation as far as I'm aware.

Am I doing something wrong?

来源:https://stackoverflow.com/questions/30399526/youtube-v3-api-returns-status-code-400-for-a-valid-request

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