2017-04-25 148 views
0

我试图删除followiing评论z12mdhjgxrfgtpf3d231jrz5vo3jdj0lothis video YouTube上的视频删除评论,但响应代码是我使用的频道的管理员的令牌400与https://www.googleapis.com/auth/youtube.force-ssl范围,因为它要求documentation无法通过API

请求为:

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" 
} 
+0

似乎无权删除该评论。您是否确定您的访问令牌有效且适用于正确的渠道? – paolo

+0

我这么认为。我向该问题添加了令牌信息,并且它需要'force-ssl'作用域,并且用户109704411339866376304是该频道的所有者。 – micobg

回答

1

你不能够删除评论的原因是,你使用Comments.delete删除写由其他用户评论。 Comments.delete只会删除自己在视频中的评论。

要删除其他用户的评论,请使用Comments.setModerationStatus并将moderationStatus设置为“rejected”。

所以只要重复你所做的,但这次使用Comments.setModerationStatus。测试中有一个Try-it链接。