Cancel Download

Cancel a file download task.

Prerequisites

A file download task is already created.

Request Format

DELETE https://{apigw-address}/data-federation/v2.0/channels/read/{channelId}/download/{taskId}

Request Parameters (URI)

Name Location (Path/Query) Mandatory/Optional Data Type Description
orgId Query Mandatory String The organization ID. How to get the orgId>>
channelId Path Mandatory String Channel ID.
taskId Path Mandatory String ID of the file download task.

Response Parameters

Name Data Type Description
data List<JSONObject> Return the status information of the download task. See Status Struct

Status

Name Data Type Description
taskId String ID of the file download task.
progressCode Integer Status code of the file download task (4: cancelling).
progressDesc String Description of the status code.

Samples

Request Sample

url: https://{apigw-address}/data-federation/v2.0/channels/read/{channelId}/download/{taskId}?orgId={}

method: DELETE

Return Sample

{
  "msg": "OK",
  "code": 0,
  "data": {
    "taskId": "40e1503fa6354acb8c6266400e8fe909",
    "progressCode": "4",
    "progressDesc": "cancelling"
  }
}

Java SDK Sample

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();
        }
    }
}