问题
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