Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Youtube api 无法通过API删除Youtube视频上的评论_Youtube Api_Youtube Data Api - Fatal编程技术网

Youtube api 无法通过API删除Youtube视频上的评论

Youtube api 无法通过API删除Youtube视频上的评论,youtube-api,youtube-data-api,Youtube Api,Youtube Data Api,我试图删除上的以下注释z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo,但响应代码为400。我正在使用通道管理员的令牌,其作用域为所需 请求是: DELETE https://www.googleapis.com/youtube/v3/comments?id=z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo&alt=json { "query_params": { "id": "z12mdhjgxrfgtpf3d231jrz

我试图删除上的以下注释z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo,但响应代码为400。我正在使用通道管理员的令牌,其作用域为所需

请求是:

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

{
    "query_params": { 
        "id": "z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo",
        "alt": "json"
    }
}
答复如下:

{
 "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."
 }
}
这个请求有什么问题

这是令牌调试信息:

{
    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"
}

您无法删除该评论的原因是您正在使用删除由其他用户编写的评论<代码>评论。删除仅删除视频中您自己的评论

要删除其他用户的评论,请使用并将moderationStatus设置为“
已拒绝”


因此,只需重复您所做的操作,但这次使用的是
Comments.setModerationStatus
。出于测试目的,链接中有一个“试用”按钮。

似乎您无权删除该评论。您是否绝对确定您的访问令牌是有效的,并且适用于正确的频道?我想是的。我在问题中添加了令牌信息,它需要“强制ssl”作用域,用户109704411339866376304是通道的所有者。