Protocol | HTTP GET |
|---|---|
Direction | Developer server -> HUAWEI Drive server |
URL | https://driveapis.cloud.huawei.com.cn/drive/v1/files/{fileId}/comments/{commentId}/replies |
Data Format | Request: Content-Type: application/json Response: Content-Type: application/json |
Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
fileId | Mandatory | string | File ID. |
commentId | Mandatory | string | Comment ID. |
Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
pageSize | Optional | integer | Maximum number of results to return per page. The default value is 100. The value ranges from 1 to 100. Note: It is possible that partial or empty result pages are returned before the end of the result list has been reached. |
cursor | Optional | string | Cursor for the current page, which is obtained from nextCursor in the previous response. |
fields | Mandatory | string | Fields in the request, which are in the partial response format. For details, please refer to Overview. |
form | Optional | string | Media format. |
prettyPrint | Optional | boolean | Indicates whether to return a response in a human-readable format. |
quotaId | Optional | string | User identifier, which can contain a maximum of 40 characters. This parameter is used to restrict the maximum number of API calls for a single user. |
callback | Optional | string | Callback function used in JSONP requests. |
Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
Authorization | Mandatory | string | User authorization information, that is, the access token (AT). |
x-hw-trace-id | Optional | string | ID used for service tracing. |
x-hw-app-id | Optional | string | App ID. |
version | Optional | string | SDK version number. |
x-hw-terminal | Optional | string | Device model. |
x-hw-os | Optional | string | Device operating system. |
unionID | Optional | string | User's UnionID. |
User-Agent | Optional | string | App version number or app ID. |
x-hw-deviceUUID | Optional | string | UUID of the device. |
x-hw-deviceUDID | Optional | string | UDID of the device. |
x-hw-appPackageName | Optional | string | App package name. |
x-hw-network | Optional | string | Network type. The options include WiFi, 2G, 3G, 4G, 5G, and wire. |
Request Body
None.
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
When the status code is 200:
Parameter | Type | Description |
|---|---|---|
category | string | Resource type. The value is always drive#replyList. |
nextCursor | string | Cursor for the next page. If nextCursor is empty, there is no next page. |
replies[] | list | List of replies to the comment. |
replies.category | string | Reply type. The value is always drive#reply. |
replies.id | string | Reply ID. |
replies.createdTime | string | Time when the reply is created. |
replies.editedTime | string | Last time when the reply is modified. |
replies.creator.category | string | User type. The value is always drive#user. |
replies.creator.displayName | string | Display name of the user. |
replies.creator.profilePhotoLink | string | Link to the user's profile picture, which is not returned by default. |
replies.creator.me | boolean | Indicates whether the user is the requesting user. |
replies.creator.permissionId | string | Permission ID. |
replies.creator.userAccount | string | Account of the user, which is not returned by default. |
replies.htmlDescription | string | Reply content in HTML format. |
replies.description | string | Reply content. |
replies.deleted | boolean | Indicates whether the reply is deleted. |
replies.operate | string | Operation to be performed for the comment. |
{
"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"
} The last four digits in the result code indicate the service error code, which is used to differentiate error scenarios. For details about other service error codes, please refer to Status Codes.
Status Code | Result Code | Response Code | Description |
|---|---|---|---|
200 | NA | - | Success. |
400 | 21004001 | LACK_OF_PARAM | Input parameter is missing. Check the parameter list. |
400 | 21004002 | PARAM_INVALID | Parameter verification failed. Check the parameter list. |
403 | 21004032 | SERVICE_NOT_SUPPORT | The service is not supported. |
403 | 21004035 | INSUFFICIENT_SCOPE | Scope verification failed. |
403 | 21004036 | INSUFFICIENT_PERMISSION | Insufficient role permission. |
500 | 21005006 | SERVER_TEMP_ERROR | Server error. |
403 | 21074033 | AGREEMENT_NOT_SIGNED | The HUAWEI Drive user agreement is not signed. Try again after the agreement is signed. |
403 | 21084031 | DATA_MIGRATINT | The security policy is being updated. Please wait until the update is complete. |
404 | 21084041 | CONTENT_NOT_FOUND | No resources found. |
500 | 21085002 | OUTER_SERVICE_UNAVAILABLE | Server error. |
500 | 21085006 | SERVER_TEMP_ERROR | Server error. |
public static void main(String[] args) throws IOException {
// Set the request URL, file ID, comment ID, and access token.
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==";
// List replies to the comment.
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();
}
}