List Channels

Get the list of channels (Read and Write) to which the application is authorized.

Prerequisites

The user must be an EnOS user.

Request Format

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

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 The organization ID. How to get the orgId>>
channelType Query Optional String

The channel type, READ or WRITE. If not specified, lists all the channels to which the application is authorized.

  • READ: for querying data from storage systems.
  • WRITE: for writing data to storage systems.

Response Parameters

Name Data Type Description
data List<Object> The list of channels. For more information, see Channel Information Struct

Channel Information Struct

Name Data Type Description
channelType String The channel type (READ or WRITE).
channelId String The channel ID.
channelStatus String The status of the channel (STARTING, START, STOPING, STOP, or ERROR).
dataSourceInfo List<Object> The list of data sources associated with the channel. For more information, see Data Source Information Struct
channelResource List<JSONObject> The resource configuration for the channel. For more information, see Resource Configuration Struct

Data Source Information Struct

Name Data Type Description
dataSourceName String The data source name.
dataSourceType String The data source type.
alias String Alias of the data source.
extra List<JSONObject> Extra information, which includes name of the execution queue. For more information, see Extra Information Struct

Resource Configuration Struct

Name Data Type Description
reourceId String Resource ID.
resourceConfig String Resource configuration amount.
ifMultiSourceAnalysis Boolean Whether multi-source analysis is enabled.
Extra Information Struct
Name Data Type Description
queue String Name of the execution queue.

Samples

Request Sample

url: https://{apigw-address}/data-federation/v2.0/channels?orgId={}&channelType={}

method: GET

Return Sample

{
  "msg": "OK",
  "code": 0,
  "data": [
    {
      "channelId": "",
      "channelName": "",
      "channelType": "WRITE",
      "channelStatus": "STOP",
      "dataSourceInfo": [
        {
          "alias": "",
          "extra": {
            "queue": "root.edp_data_federation"
          },
          "dataSourceName": "",
          "dataSourceType": ""
        }
      ],
      "channelResource": {
        "resourceId": "",
        "resourceConfig": "2cu",
        "ifMultiSourceAnalysis": false
      }
    }
  ]
}

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 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 listChannels() {
        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).debug())
                    .url(url + "/data-federation/v2.0/channels")
                    .getResponse(request, JSONObject.class);
            System.out.println(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}