3

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?

Adam Drewery
  • 1,508
  • 1
  • 17
  • 25
  • According to the reference (https://developers.google.com/youtube/v3/docs/comments/setModerationStatus), processingFailure "usually indicates that the request's input is invalid" – paolo May 23 '15 at 21:07
  • yeah... although this request is about as valid as it gets! – Adam Drewery May 25 '15 at 14:17
  • Are you sure the access token is correct? And by correct I also mean not containing ans chars like & and ? and stuff. – paolo May 25 '15 at 16:12
  • it's a valid access token, although today I tried with a new account, created a new video on a new channel and I appear to be able to remove my own comments, and moderate others. – Adam Drewery May 26 '15 at 12:18
  • 1
    Did you also change the dev console account? Maybe the YouTube API is not activated in the console. – paolo May 26 '15 at 12:24
  • I made sure I was using OAuth when using the dev console. Is that what you mean? – Adam Drewery May 26 '15 at 12:26
  • What I mean is that you possibly have to enable the "YouTube Data API" under "APIs & Auth" -> "APIs" in the dev console. If it's disabled, requests will keep failing. – paolo May 26 '15 at 12:34
  • Aaah right i see what you mean. That's not the issue here though unfortunately. Thanks for the heads up though.... will keep an eye out for that.:) – Adam Drewery May 26 '15 at 12:59
  • Did you find a way to fix it? Is there related to this issue? https://stackoverflow.com/questions/40507691/youtube-api-commentthreads-update-return-400-error-when-replying-to-toplevelcomm – Alex Benfica Nov 19 '16 at 09:07

0 Answers0