IAcsClient is the Java client of the aliyun-java-sdk-green Java SDK. To use the aliyun-java-sdk-green Java SDK to initiate an API call, initialize an IAcsClient instance and modify the IClientProfile configurations as needed.

Precautions

When creating an IAcsClient instance, you must specify the region and the AccessKey ID and AccessKey secret of your Alibaba Cloud account.
  • For more information about the supported regions, see Request structure.
  • For more information about how to obtain the AccessKey ID and AccessKey secret of your Alibaba Cloud account, see Create an AccessKey.

Create an IAcsClient instance to moderate images, audio, videos, and text

The following regions are supported:
  • cn-shanghai: China (Shanghai)
  • cn-beijing: China (Beijing)
  • ap-southeast-1: Singapore
  • us-west-1: US (Silicon Valley)
Note Only certain algorithmic models are available in the ap-southeast-1 and us-west-1 regions.
Use the following code to create an IAcsClient instance to moderate images, audio, videos, and text:
/**
      * Set the ALIYUN_ACCESS_KEY_ID and ALIYUN_ACCESS_KEY_SECRET parameters to the AccessKey ID and AccessKey secret of your Alibaba Cloud account, respectively.
      * Currently, only the cn-shanghai, cn-beijing, ap-southeast-1, and us-west-1 regions are supported. Do not set the REGION_ID parameter to a region other than the preceding ones.
      * Security risks may arise if you log on with the AccessKey pair of an Alibaba Cloud account because the account has permissions on all API operations. We recommend that you log on as a RAM user to call API operations or perform routine operations and maintenance. To create a RAM user, log on to https://ram.console.aliyun.com.
      */
     String ALIYUN_ACCESS_KEY_ID = "<Your AccessKey ID>"
     String ALIYUN_ACCESS_KEY_SECRET = "<Your AccessKey secret>";
     String REGION_ID = "cn-shanghai";

     IClientProfile profile = DefaultProfile.getProfile(REGION_ID, ALIYUN_ACCESS_KEY_ID, ALIYUN_ACCESS_KEY_SECRET);
     IAcsClient recognitionClient = new DefaultAcsClient(profile)

Create an IAcsClient instance to manage custom image libraries, term libraries, and text pattern libraries

The supported region is cn-shanghai. The server can automatically synchronize data if you initiate a request in a region other than cn-shanghai.

Use the following code to create an IAcsClient instance to manage custom image libraries, term libraries, and text pattern libraries:
/**
      * Set the ALIYUN_ACCESS_KEY_ID and ALIYUN_ACCESS_KEY_SECRET parameters to the AccessKey ID and AccessKey secret of your Alibaba Cloud account, respectively.
      * Currently, only the cn-shanghai region is supported. Do not set the REGION_ID parameter to any other regions.
      * Security risks may arise if you log on with the AccessKey pair of an Alibaba Cloud account because the account has permissions on all API operations. We recommend that you log on as a RAM user to call API operations or perform routine operations and maintenance. To create a RAM user, log on to https://ram.console.aliyun.com.
      */
     String ALIYUN_ACCESS_KEY_ID = "<Your AccessKey ID>"
     String ALIYUN_ACCESS_KEY_SECRET = "<Your AccessKey secret>";
     String REGION_ID = "cn-shanghai";

     IClientProfile profile = DefaultProfile.getProfile(REGION_ID, ALIYUN_ACCESS_KEY_ID, ALIYUN_ACCESS_KEY_SECRET);
     IAcsClient managementClient = new DefaultAcsClient(profile)