com.netease.yidun.sdk.antispam.keyword.KeywordDeleteDemo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yidun-java-sdk-demo Show documentation
Show all versions of yidun-java-sdk-demo Show documentation
Yidun OpenAPI SDK Demo for Java
The newest version!
package com.netease.yidun.sdk.antispam.keyword;
import com.netease.yidun.sdk.AbstractDemo;
import com.netease.yidun.sdk.antispam.AntispamRequester;
import com.netease.yidun.sdk.antispam.keyword.v1.delete.KeywordDeleteRequest;
import com.netease.yidun.sdk.antispam.keyword.v1.delete.KeywordDeleteResponse;
/**
* 关键词删除demo
*/
public class KeywordDeleteDemo extends AbstractDemo {
public static void main(String[] args) {
// 实例化一个requester,入参需要传入易盾内容安全分配的secretId,secretKey
AntispamRequester antispamRequester = createAntispamRequester("SecretId", "SecretKey");
// 实例化发起请求的client对象
KeywordClient keywordClient = KeywordClient.getInstance(antispamRequester);
// 实例化请求对象
KeywordDeleteRequest deleteRequest = new KeywordDeleteRequest();
// 设置易盾内容安全分配的businessId
deleteRequest.setBusinessId("BusinessId");
// 设置删除内容
deleteRequest.setIds("1,2");
// 请求对象中的其他参数如果有需要,请参考官方接口文档中字段说明,按需添加
KeywordDeleteResponse deleteResponse = null;
try {
// 发起删除请求
deleteResponse = keywordClient.delete(deleteRequest);
} catch (Exception e) {
e.printStackTrace();
}
if (deleteResponse != null && deleteResponse.getCode() == 200) {
Boolean result = deleteResponse.getResult();
// 根据需要获取关键词的删除结果,具体返回字段的说明,请参考官方接口文档中字段说明
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy