edit-icon download-icon

Access guidelines

Last Updated: Nov 16, 2018

This document describes the steps of accessing EDAS APIs, including instructions on how to obtain the SDK and descriptions of initialization parameters. It also provides an example of a specific API call.

Obtain the SDK

For Maven users

Add the following open API SDK dependency to the pom.xml file:

  1. <dependency>
  2. <groupId>com.aliyun&lt;/groupId>
  3. <artifactId>aliyun-java-sdk-edas&lt;/artifactId>
  4. <version>2.16.2-SNAPSHOT</version>
  5. </dependency>

NOTE: If you cannot obtain the SDK after the dependency is added, add the following profile to the setting.xml file of the local repository (the file is in .m2 of the user directory).If you still cannot obtain the SDK after the profile is added, open a ticket to consult with us.

  1. <profiles>
  2. <profile>
  3. <id>allow-snapshots</id>
  4. <activation>&lt;activeByDefault>true&lt;/activeByDefault></activation>
  5. <repositories>
  6. <repository>
  7. <id>snapshots-repo</id>
  8. <url>https://oss.sonatype.org/content/repositories/snapshots</url>
  9. <releases><enabled>false</enabled></releases>
  10. <snapshots><enabled>true</enabled></snapshots>
  11. </repository>
  12. </repositories>
  13. </profile>
  14. </profiles>
  15. <activeProfiles>
  16. <activeProfile>allow-snapshots&lt;/activeProfile>
  17. </activeProfiles>

For non-Maven users

Download the JAR package from the following version list and add the package to the project:

Version 2.16.0-SNAPSHOT: http://edas.oss-cn-hangzhou.aliyuncs.com/edas-pop-api/2.16.0-SNAPSHOT/aliyun-java-sdk-edas-2.16.0-snapshot.jar

Common request parameters

Parameter Description
regionId Unique ID of the region where the API gateway is located. For details, see the list of EDAS supported regions.
accessKeyId/accessKeySecret Access Key ID and Access Key Secret that you obtain on Alibaba Cloud website, which are different for the primary account and subaccount.
productName Open API product name. Set this parameter to EDAS.
domain Domain of the endpoint for open API access, in the format of edas.${RegionId}.aliyuncs.com. For details about the list of regions with support for EDAS open APIs, see the following section.

Use of a subaccount

Currently, APIs can be called by subaccounts. In this case, enter the Access Key ID and Access Key Secret of each subaccount. In addition, subaccounts must be authorized by the primary accounts to use the corresponding resources. For more information, see [Authorize permissions to subaccounts] in subaccount management documentation(44023).

Supported regions

Region RegionId Domain Domain (VPC environment) Remarks
China (Beijing) cn-beijing edas.cn-beijing.aliyuncs.com edas-vpc.cn-beijing.aliyuncs.com This endpoint is recommended for users in China (Beijing).
China (Qingdao) cn-qingdao  edas.cn-qingdao.aliyuncs.com  Not supported This endpoint is recommended for users in China (Qingdao).
China (Shenzhen) cn-shenzhen  edas.cn-shenzhen.aliyuncs.com  edas-vpc.cn-shenzhen.aliyuncs.com This endpoint is recommended for users in China (Shenzhen).
China (Hangzhou) cn-hangzhou  edas.cn-hangzhou.aliyuncs.com  edas-vpc.cn-hangzhou.aliyuncs.com This endpoint is recommended for users in China (Hangzhou).
China (Shanghai) cn-shanghai  edas.cn-shanghai.aliyuncs.com  edas-vpc.cn-shanghai.aliyuncs.com This endpoint is recommended for users in China (Shanghai).
Singapore ap-southeast-1  edas.ap-southeast-1.aliyuncs.com  Not supported This endpoint is recommended for users in Singapore.

Request example

To use Open APIs, launch the Open API client, configure an endpoint, and set public parameters such as regionId and accessKeyId.Here is a sample API request.

  1. public static void main(String[] args) throws ClientException{
  2. /**
  3. *Endpoint used to access the open API. Set it based on the list of EDAS supported regions and the region where your instance is located.
  4. */
  5. String regionId = "XXXXX";
  6. /**
  7. *Access Key ID used for authentication. Obtain it in the Alibaba Cloud console.
  8. */
  9. String accessKeyId = "XXXXXXXXXXXXXXXXX";
  10. /**
  11. *Access Key Secret used for authentication. Obtain it in the Alibaba Cloud console.
  12. */
  13. String accessKeySecret = "XXXXXXXXXXXXXXXXX";
  14. /**
  15. * Name of the cloud product that you access using the open API. Set it to EDAS.
  16. */
  17. String productName ="Edas";
  18. /**
  19. *Domain of the endpoint. For details, see the domains in the list of EDAS supported regions.
  20. */
  21. String domain ="edas.XXXXX.aliyuncs.com";
  22. // Construct the open API client
  23. DefaultProfile.addEndpoint(regionId,regionId,productName,domain);
  24. DefaultProfile defaultProfile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
  25. DefaultAcsClient defaultAcsClient = new DefaultAcsClient(defaultProfile);
  26. defaultAcsClient.setAutoRetry(false);
  27. // Construct the API request for listing application deployment groups. For details about the input parameters, see API description.
  28. String appId = "xxxxxxxxx";
  29. ListDeployGroupRequest request = new ListDeployGroupRequest();
  30. // For details about the input parameters, see API description.
  31. request.setAppId(appId);
  32. ListDeployGroupResponse response = defaultAcsClient.getAcsResponse(request);
  33. // Result parsing (If Code 200 is returned, the API call is successful; if any other code is returned, the API call fails. For details, see the error code list.)
  34. if (response.getCode() == 200) {
  35. // Parse the returned result (For details, see the return value description of the API.)
  36. List&lt;DeployGroup> deployGroups = response.getDeployGroupList();
  37. if (CollectionUtils.isNotEmpty(deployGroups)) {
  38. for (DeployGroup deployGroup : deployGroups) {
  39. System.out.println(deployGroup.getGroupName());
  40. System.out.println(deployGroup.getGroupId());
  41. }
  42. }
  43. } else {
  44. // Print the cause of the error
  45. System.out.println(response.getMessage());
  46. }
  47. }
Thank you! We've received your feedback.