List Jobs

Get the data reading jobs or data writing jobs of a specified channel.

Prerequisites

Channels are created and started in the organization.

Request Format

GET https://{apigw-address}/data-federation/v2.0/channels/read/{channelId}/jobs

Request Parameters (Header)

Name

Mandatory/Optional

Data Type

Description

Content-Type

Mandatory

String

Content or file type. The default value is application/json.

Request Parameters (URI)

Name

Location (Path/Query)

Mandatory/Optional

Data Type

Description

orgId

Query

Mandatory

String

Your organization ID. How to get the orgId>>

channelId

Path

Mandatory

String

Channel ID.

Response Parameters

Name

Data Type

Description

data

List<Object>

List of returned jobs. For more information, see Job Data Struct

Job Data Struct

Name

Data Type

Description

runningJobs

List<Object>

List of running jobs. For more information, see Job Information Struct

finishedJobs

List<Object>

List of finished jobs. For more information, see Job Information Struct

Jon Information Struct

Name

Data Type

Description

jobId

String

Job ID.

sqlQuery

String

SQL query for getting data from storage systems.

state

String

Data querying state. State values can be Failed, Canceled, or Succeeded.

requestTime

String

Time when the job is submitted.

duration

String

Running duration of the job.

startTime

String

Time when the job started.

endTime

String

Time when the job finished.

Sample

Request Sample

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

method: GET

Return Sample

{
   "msg": "OK",
   "code": 0,
   "data": {
   "runningJobs": null,
   "finishedJobs": [
       {
         "jobId": "2131ceb9-c00d-d42d-33db-c21002b97d16",
         "sqlQuery": "show schemas",
         "state": "Succeeded",
         "requestTime": "05/27/2020 09:22:13",
         "duration": "1.871 sec",
         "startTime": 1590571333699,
         "endTime": 1590571335570
       }]
    }
 }

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 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 listJobs() {
        Request request = new Request();
        request.setQueryParam("orgId", orgId);
        request.setMethod("GET");
        request.headerParams().put(HttpHeaders.CONTENT_TYPE, "application/json");
        try {
            JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey))
                    .url(url + "/data-federation/v2.0/channels/read/" + chId + "/jobs")
                    .getResponse(request, JSONObject.class);
            System.out.println(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}