Cancel Download¶
取消文件下载任务。
前提条件¶
已创建文件下载任务。
请求格式¶
DELETE https://{apigw-address}/data-federation/v2.0/channels/read/{channelId}/download/{taskId}
请求参数(URI)¶
名称 |
位置(Path/Query) |
必需/可选 |
数据类型 |
描述 |
---|---|---|---|---|
orgId |
Query |
必需 |
String |
用户所属的组织ID。如何获取orgId信息>> |
channelId |
Path |
必需 |
String |
通道ID。 |
taskId |
Path |
必需 |
String |
文件下载任务ID。 |
响应参数¶
名称 |
数据类型 |
描述 |
---|---|---|
data |
List<JSONObject> |
返回下载任务状态信息,详见 下载任务状态结构体 |
下载任务状态结构体 ¶
名称 |
数据类型 |
描述 |
---|---|---|
taskId |
String |
文件下载任务ID。 |
progressCode |
Integer |
文件下载任务状态码(4:取消中)。 |
progressDesc |
String |
文件下载任务状态描述。 |
示例¶
请求示例¶
url: https://{apigw-address}/data-federation/v2.0/channels/read/{channelId}/download/{taskId}?orgId={}
method: DELETE
返回示例¶
{
"msg": "OK",
"code": 0,
"data": {
"taskId": "40e1503fa6354acb8c6266400e8fe909",
"progressCode": "4",
"progressDesc": "cancelling"
}
}
Java SDK调用示例¶
import com.alibaba.fastjson.JSONObject;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envision.apim.poseidon.request.PoseidonRequest;
import com.google.common.net.HttpHeaders;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Sample {
private static String accessKey = "AccessKey of your APP";
private static String secretKey = "SecretKey of your APP";
private static String orgId = "yourOrgId";
private static String chId = "yourChannelId";
private static String taskId = "yourTaskId";
private static String url = "https://{domain_url}";
private static class Request extends PoseidonRequest {
public void setQueryParam(String key, Object value) {
queryEncodeParams().put(key, value);
}
public void setMethod(String method) {
this.method = method;
}
public void setBodyParams(String key, Object value) {
bodyParams().put(key, value);
}
private String method;
@Override
public String baseUri() {
return "";
}
@Override
public String method() {
return method;
}
}
@Test
public void cancelDownload() {
Request request = new Request();
request.setQueryParam("orgId", orgId);
request.setMethod("DELETE");
try {
JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey))
.url(url + "/data-federation/v2.0/channels/read/" + chId + "/download/" + taskId)
.getResponse(request, JSONObject.class);
System.out.println(response);
} catch (Exception e) {
e.printStackTrace();
}
}
}