edit-icon download-icon

Access guidelines

Last Updated: Jun 20, 2018

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

Obtain the SDK

  1. For Maven users

    In the pom.xml file, add the SDK dependency on the Open API:

    1. <dependency>
    2. <groupId>com.aliyun</groupId>
    3. <artifactId>aliyun-java-sdk-edas</artifactId>
    4. <version>2.16.1-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 (Usually found under .m2 of the user directory). If you still cannot obtain the SDK, please create a ticket.

    1. <profiles>
    2. <profile>
    3. <id>allow-snapshots</id>
    4. <activation><activeByDefault>true</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</activeProfile>
    17. </activeProfiles>
  2. 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

Public request parameters

Parameter Description
regionId Unique ID of the region where the API gateway is located. For more information, see the list of regions that EDAS supports.
accessKeyId/accessKeySecret Access Key ID and Access Key Secret obtained from the Alibaba Cloud website for distinguishing the primary account and sub-accounts.
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 a list of EDAS regions that support Open APIs, see the following table.

Supported regions

Region Region ID Domain (POP public parameter) Remarks
China North 2 (Beijing) cn-beijing edas.cn-beijing.aliyuncs.com This endpoint is recommended for users in China North 2 (Beijing).
China North 1 (Qingdao) cn-qingdao  edas.cn-qingdao.aliyuncs.com  This endpoint is recommended for users in China North 1 (Qingdao).
China South 1 (Shenzhen) cn-shenzhen  edas.cn-shenzhen.aliyuncs.com  This endpoint is recommended for users in China South 1 (Shenzhen).
China East 1 (Hangzhou) cn-hangzhou  edas.cn-hangzhou.aliyuncs.com  This endpoint is recommended for users in China East 1 (Hangzhou).
China East 2 (Shanghai) cn-shanghai  edas.cn-shanghai.aliyuncs.com  This endpoint is recommended for users in China East 2 (Shanghai).
Singapore ap-southeast-1  edas.ap-southeast-1.aliyuncs.com  This endpoint is recommended for users in Singapore.

Sample request

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 more information, 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 more information about the input parameters, see API description.
  28. String appId = "xxxxxxxxx";
  29. ListDeployGroupRequest request = new ListDeployGroupRequest();
  30. // For more information 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 more information, see the error code list.)
  34. if (response.getCode() == 200) {
  35. // Parse the returned result (For more information, see the return value description of the API.)
  36. List<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.