本示例介绍使用Alibaba Cloud SDK for Java调用DescribeLiveSnapshotDetectPornConfig接口查询审核配置。

前提条件

请在pom.xml文件中增加以下依赖,准确的SDK版本号,请参见阿里云开发工具包(SDK)

<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>aliyun-java-sdk-live</artifactId>
    <version>3.7.5</version>
 </dependency>

示例代码

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.live.model.v20161101.DescribeLiveSnapshotDetectPornConfigRequest;
import com.aliyuncs.live.model.v20161101.DescribeLiveSnapshotDetectPornConfigResponse;
import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.Gson;

/**
 * 添加审核回调
 */
public class TestDescribeLiveSnapshotDetectPornConfig {

    public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile(
                "<your-region-id>", // 地域ID,可以通过接口 DescribeRegions 查看可用的地域ID。
                "<your-access-key-id>", // 您的AccessKey ID
                "<your-access-key-secret>"); // 您的AccessKey Secret
         IAcsClient client = new DefaultAcsClient(profile);

            DescribeLiveSnapshotDetectPornConfigRequest request = new DescribeLiveSnapshotDetectPornConfigRequest();
            // 用户域名。
            request.setDomainName("www.yourDomainName.com");
            // app名,如不给出表示域名下所有的
            request.setAppName("testApp");
            // 排序,asc:升序,desc:降序,默认:asc
            request.setOrder("desc");
            // 每页大小,默认值:10,范围:[5,30]
            request.setPageSize(5);
            //分页的页码,默认值:1
            request.setPageNum(1);

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

    }

}