IAcsClient is the Java client of aliyun-java-sdk-green, Content Moderation SDK for Java. Before you use aliyun-java-sdk-green to make an API call, you must initialize an IAcsClient instance and modify the IClientProfile configurations as needed.

Create an IAcsClient instance

When you create 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 Endpoints.
  • For more information about the AccessKey pair of an Alibaba Cloud account, see Create an AccessKey pair.

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 (Singapore)
Note Only specific algorithmic models are available in the Singapore (Singapore) region.
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. 
      * Valid values of the REGION_ID parameter: cn-shanghai, cn-beijing, and ap-southeast-1. Other regions are not supported. 
      * 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 (O&M). 
      */
     String ALIYUN_ACCESS_KEY_ID = "<yourAccessKeyId>";
     String ALIYUN_ACCESS_KEY_SECRET = "<yourAccessKeySecret>";
     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

Only the China (Shanghai) region is supported. The region ID is cn-shanghai. After you create an IAcsClient instance in the China (Shanghai) region, the server can automatically synchronize data if you initiate a request in other regions.

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. 
      * Set the REGION_ID parameter to cn-shanghai. Other regions are not supported. 
      * 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 O&M. 
      */
     String ALIYUN_ACCESS_KEY_ID = "<yourAccessKeyId>";
     String ALIYUN_ACCESS_KEY_SECRET = "<yourAccessKeySecret>";
     String REGION_ID = "cn-shanghai";

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