micobg
micobg

Reputation: 1342

Cannot delete comment on Youtube video via API

I'm trying to delete followiing comment z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo on this video but the response code is 400. I'm using token of the channel's admin with https://www.googleapis.com/auth/youtube.force-ssl scope as it required by documentation.

The request is:

DELETE https://www.googleapis.com/youtube/v3/comments?id=z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo&alt=json

{
    "query_params": { 
        "id": "z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo",
        "alt": "json"
    }
}

The response:

{
 "error": {
  "errors": [
   {
    "domain": "youtube.comment",
    "reason": "processingFailure",
    "message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid.",
    "locationType": "parameter",
    "location": "id"
   }
  ],
  "code": 400,
  "message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid."
 }
}

What is wrong with the request?

That's token debug info:

{
    issued_to: "493985796851.apps.googleusercontent.com",
    audience: "493985796851.apps.googleusercontent.com",
    user_id: "109704411339866376304",
    scope: "https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.upload",
    expires_in: 2452,
    access_type: "offline"
}

Upvotes: 1

Views: 440

Answers (1)

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17651

The reason you're not able to delete the comment is that you're using Comments.delete to remove comment which was written by other users . Comments.delete only deletes your own comments in your video.

To delete comment of other users, use Comments.setModerationStatus and set moderationStatus to "rejected".

So just repeat what you did but this time using Comments.setModerationStatus. There's a Try-it in the link for testing purposes.

Upvotes: 2

Related Questions