合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
列举回复列表。
Replies.list接口实现列举评论的所有回复。
| 承载协议 | HTTP GET |
|---|---|
| 接口方向 | 开发者服务器->华为云空间服务器 |
| 接口URL | https://driveapis.cloud.huawei.com.cn/drive/v1/files/{fileId}/comments/{commentId}/replies |
| 数据格式 | 请求消息:Content-Type: application/json 响应消息:Content-Type: application/json |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| fileId | 是 | string | 文件ID。 |
| commentId | 是 | string | 评论ID。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| pageSize | 否 | integer | 每页返回的个数,默认是100,可接受值1-100。注意在到达最后的列表之前,实际有可能返回部分或者空结果。 |
| cursor | 否 | string | 当前页游标,由前一个响应的nextCursor获取。 |
| fields | 是 | string | 采用[Partial-response格式],具体使用见公共说明。 |
| form | 否 | string | 媒体格式。 |
| prettyPrint | 否 | boolean | 是否以美观格式输出。 |
| quotaId | 否 | string | 用户标识,小于40个字符。用于限制单个用户的API访问数量。 |
| callback | 否 | string | JSONP的callback函数。 |
Request Header
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| Authorization | 是 | string | 用户鉴权信息 AccessToken(即AT) |
| x-hw-trace-id | 否 | string | 业务跟踪id。 |
| x-hw-app-id | 否 | string | 应用的appid。 |
| version | 否 | string | SDK版本。 |
| x-hw-terminal | 否 | string | 终端型号。 |
| x-hw-os | 否 | string | 终端操作系统类型。 |
| unionID | 否 | string | 用户的unionID。 |
| User-Agent | 否 | string | 应用版本号/appid。 |
| x-hw-deviceUUID | 否 | string | 设备UUID。 |
| x-hw-deviceUDID | 否 | string | 设备UDID。 |
| x-hw-appPackageName | 否 | string | 应用包名。 |
| x-hw-network | 否 | string | 网络类型,[WiFi, 2G, 3G, 4G, 5G, wire]。 |
Request Body
无
GET https://driveapis.cloud.huawei.com.cn/drive/v1/files/AAAB9Wn0DTQCIqPbW9avGjAQo9dbxg04A/comments/BkytC_85-y5hoiLxCRnNCHZcDynNC_siY/replies?fields=* HTTP/1.1 Accept: application/json Authorization: Bearer CV3PnPLZXyr9K2GV7RYZkF962JZvoEkMQhTho3QHQAPQUyma/lEyZskP/IMWrc7FvaeHivO7y0lyibI/fQvulBnTgtXArSVPsjaLKvYNkDsJSaIR2/sx+K40bYDWWpKFvJNKg2U47jRwz2mfiF3ortNk Cache-Control: no-cache
状态码为200时:
| 参数 | 参数类型 | 描述 |
|---|---|---|
| category | string | 类型,固定为drive#replyList。 |
| nextCursor | string | 下一页游标,为空表示最后一页。 |
| replies[] | list | 回复列表。 |
| replies.category | string | 类型,固定为drive#reply。 |
| replies.id | string | 回复id。 |
| replies.createdTime | string | 回复创建时间。 |
| replies.editedTime | string | 回复修改时间。 |
| replies.creator.category | string | 类型,固定为drive#user。 |
| replies.creator.displayName | string | 用户显示名。 |
| replies.creator.profilePhotoLink | string | 用户头像链接(默认不返回)。 |
| replies.creator.me | boolean | 是否是我。 |
| replies.creator.permissionId | string | 权限id。 |
| replies.creator.userAccount | string | 帐号名称(默认不返回)。 |
| replies.htmlDescription | string | html内容。 |
| replies.description | string | 内容。 |
| replies.deleted | boolean | 评论回复是否已删除。 |
| replies.operate | string | 操作。 |
{
"nextCursor": "BCCDAB44ACDFA4D6EA0E435F3A7560EF0",
"replies": [
{
"creator": {
"permissionId": "299639512454136576",
"displayName": "*******3121@**3.com",
"me": true,
"category": "drive#user"
},
"editedTime": "2020-02-19T13:56:31Z",
"operate": "reopen",
"deleted": false,
"createdTime": "2020-02-19T13:56:31Z",
"description": "HuaweiTest003",
"id": "Bv_vRsfoUCBJmbCvafSFNQrvTWT12lAsS",
"category": "drive#reply",
"htmlDescription": "HuaweiTest003"
},
{
"creator": {
"permissionId": "299639512454136576",
"displayName": "*******3121@**3.com",
"me": true,
"category": "drive#user"
},
"editedTime": "2020-02-19T13:56:26Z",
"operate": "reopen",
"deleted": false,
"createdTime": "2020-02-19T13:56:26Z",
"description": "HuaweiTest002",
"id": "BvGxpclcpKkC2hMquGAZI4bhE4f7bqSlA",
"category": "drive#reply",
"htmlDescription": "HuaweiTest002"
},
{
"creator": {
"permissionId": "299639512454136576",
"displayName": "*******3121@**3.com",
"me": true,
"category": "drive#user"
},
"editedTime": "2020-02-19T13:49:33Z",
"operate": "reopen",
"deleted": false,
"createdTime": "2020-02-19T13:49:33Z",
"description": "HuaweiTest001",
"id": "BpMy9fyvWDfDM2rRKzfpNbqDkNfOnVg7w",
"category": "drive#reply",
"htmlDescription": "HuaweiTest001"
}
],
"category": "drive#replyList"
} 错误码后4位为业务错误码,用于区分错误场景,其他业务错误码见状态码章节。
| 状态码 | 错误码 | 响应代码 | 描述 |
|---|---|---|---|
| 200 | NA | - | 成功。 |
| 400 | 21004001 | LACK_OF_PARAM | 缺少入参,请检查参数列表。 |
| 400 | 21004002 | PARAM_INVALID | 参数校验失败,请检查参数列表。 |
| 403 | 21004032 | SERVICE_NOT_SUPPORT | 服务不支持。 |
| 403 | 21004035 | INSUFFICIENT_SCOPE | Scope校验失败。 |
| 403 | 21004036 | INSUFFICIENT_PERMISSION | 角色权限不足。 |
| 500 | 21005006 | SERVER_TEMP_ERROR | 服务器异常。 |
| 403 | 21074033 | AGREEMENT_NOT_SIGNED | 用户还未签署华为云空间用户协议,请签署协议后再进行重试。 |
| 403 | 21084031 | DATA_MIGRATING | 正处于安全策略更新, 请等待安全策略更新完成。 |
| 404 | 21084041 | CONTENT_NOT_FOUND | 资源未找到。 |
| 500 | 21085002 | OUTER_SERVICE_UNAVAILABLE | 服务器异常。 |
| 500 | 21085006 | SERVER_TEMP_ERROR | 服务器异常。 |
public static void main(String[] args) throws IOException {
// 设置请求地址,文件ID,评论ID和用户认证令牌
String url = "https://driveapis.cloud.huawei.com.cn/drive/v1/files";
String fileId = "AB0tr6O8DTQAguUs3yPFt3wQ5SDfLg04A";
String commentId = "BlIuT9Ue4I8qnKGDcmf9MUZf5sCpjOCDK";
String access_token = "CV5T547SEXpRlyuxqvz+PnRCtnVu784+OEIXmXAafKC+ifA3eJRnM0Ttsv20bJCkrcA+FNi4bU4nKcbERpQxlkMLQ6/Xt1iEQJYrFMyamnnI9JUV+jz4cQ==";
// 获取评论回复列表
JSONObject replyInfo = repliesList(url, access_token, fileId, commentId);
System.out.println(replyInfo.toJSONString());
}
private static JSONObject repliesList(String url, String access_token, String fileId, String commentId) throws IOException {
StringBuilder stringBuilder = new StringBuilder("");
stringBuilder.append("/").append(fileId).append("/").append("comments").append("/").append(commentId).append("/").append("replies");
stringBuilder.append("?").append("fields=*");
stringBuilder.append("&").append("prettyPrint=true");
HttpGet httpGet = new HttpGet(url + stringBuilder);
httpGet.setHeader("Authorization","Bearer " + access_token);
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(50000).setConnectionRequestTimeout(10000)
.setSocketTimeout(50000).build();
httpGet.setConfig(requestConfig);
CloseableHttpResponse response = HttpClientUtil.getClient().execute(httpGet);
try {
HttpEntity responseEntity = response.getEntity();
String ret = responseEntity != null ? EntityUtils.toString(responseEntity) : null;
JSONObject jsonObject = (JSONObject) JSON.parse(ret);
EntityUtils.consume(responseEntity);
return jsonObject;
}finally {
response.close();
}
}