You can use Enterprise Distributed Application Service (EDAS) SDK for Java to call the EDAS API.


Java Development Kit (JDK) 1.6 or later is installed. For more information, see JDK.

Obtain EDAS SDK for Java

You can obtain EDAS SDK for Java by using one of the following methods:
  • Use Maven. If Internet connection is available, we recommend that you use this method.

    Open the pom.xml file in the Maven project, and add the aliyun-java-sdk-core and aliyun-java-sdk-edas dependencies.

  • Import JAR packages. If Internet connection is unavailable, we recommend that you use this method.

    On a machine where Internet connection is available, download the JAR packages Alibaba Cloud SDK for Java and Alibaba Cloud EDAS SDK for Java that are required to use EDAS SDK for Java. Then, copy the JAR packages to a machine where Internet connection is unavailable and add them to your project.

Use EDAS SDK for Java to call the EDAS API

Replace the values of the aliyun_user_ak, aliyun_user_sk, and region_id parameters in the following sample code with your actual values of the common parameters. For more information about the common parameters, see Common parameters for API calls.

import java.util.List;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.edas.model.v20170801.ListApplicationRequest;
import com.aliyuncs.edas.model.v20170801.ListApplicationResponse;
import com.aliyuncs.edas.model.v20170801.ListDeployGroupRequest;
import com.aliyuncs.edas.model.v20170801.ListDeployGroupResponse;

public class ListApplicationsSimpleInfo {

    public static void main(String args[]){
        String aliyun_user_ak = "yourAccessKeyId";// The AccessKey ID of your Alibaba Cloud account or RAM user. 
        String aliyun_user_sk = "yourAccessKeySecret";// The AccessKey secret of your Alibaba Cloud account or RAM user. 
        String region_id = "cn-hangzhou";// The region where the application resides. 

        DefaultProfile defaultProfile = DefaultProfile.getProfile(region_id, aliyun_user_ak, aliyun_user_sk);
        DefaultAcsClient defaultAcsClient = new DefaultAcsClient(defaultProfile);

        ListApplicationRequest applist_req = new ListApplicationRequest();
        try {
            ListApplicationResponse applist_resp = defaultAcsClient.getAcsResponse(applist_req);
            if(applist_resp.getCode() == 200){
                List<ListApplicationResponse.Application> applist = applist_resp.getApplicationList();
                if(applist != null && applist.size() > 0){
                    for(ListApplicationResponse.Application app : applist){
                        String app_name = app.getName();
                        String app_id = app.getAppId();
                        System.out.println("Application name : " + app_name + ", Application ID : " + app_id);
                        ListDeployGroupRequest dglist_req = new ListDeployGroupRequest();
                        ListDeployGroupResponse dglist_resp = defaultAcsClient.getAcsResponse(dglist_req);
                        if(dglist_resp.getCode() == 200){
                            List<ListDeployGroupResponse.DeployGroup> dglist = dglist_resp.getDeployGroupList();
                            for(ListDeployGroupResponse.DeployGroup dg : dglist){
                                String dg_name = dg.getGroupName();
                                    dg_name = "Default group";
                                String dg_id = dg.getGroupId();
                                System.out.println("\tGroup name : " + dg_name + ", Group ID : " + dg_id);
                } else {
                    System.out.println("The returned application list is empty. Check whether an application exists in the region specified by the region_id parameter.");
            } else {
                // Print the error cause.
                System.out.println("An exception is returned after the API call.\nMessage: " + applist_resp.getMessage() + "\nRequestId: " + applist_resp.getRequestId());
        } catch (ClientException e) {

  • An API operation that is called by using EDAS SDK for Java appears in pairs, which contain <Operation name>Request and <Operation name>Response. For example, ListApplicationRequest and ListApplicationResponse are in pairs, and ListDeployGroupRequest and ListDeployGroupResponse are in pairs. <Operation name>Request constructs an API request. You can add relevant parameters to this API request, and then use AcsClient to obtain an <Operation name>Response object to carry the results returned.
  • If the version of the aliyun-java-sdk-core dependency is 4.4.3 or later, and the version of the aliyun-java-sdk-edas dependency is 2.52.1 or later, EDAS SDK for Java can automatically find the endpoint based on the region_id parameter.