All Products
Document Center


Last Updated: Jan 25, 2021

Alibaba Cloud provides SDK for Java, SDK for Python, and SDK for PHP. You can click one of the following links to download the SDK in a specific language:

For more information about SDKs in other languages, see Alibaba Cloud SDK.

References: Create an AccessKey pair.

Install an SDK

You can install an SDK by adding a Maven library or a JAR package dependency. SDK for Java is used in the example.

  • Add a Maven library

            <name>Sonatype Nexus Staging</name>
  • Add a JAR package dependency


Sample code

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import java.util.*;
import com.aliyuncs.alidns.model.v20150109.*;

public class DescribeGtmInstance {

    public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<accessKeyId>", "<accessSecret>");
        IAcsClient client = new DefaultAcsClient(profile);

        DescribeDnsGtmInstanceRequest request = new DescribeDnsGtmInstanceRequest();

        try {
            DescribeDnsGtmInstanceResponse response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
        } catch (ServerException e) {
        } catch (ClientException e) {
            System.out.println("ErrCode:" + e.getErrCode());
            System.out.println("ErrMsg:" + e.getErrMsg());
            System.out.println("RequestId:" + e.getRequestId());