以下是 Java SDK 的示例代码。请注意:调用的 API 域名是https://cn-api.aidc-ai.com
IopClient client =newIopClient("https://cn-api.aidc-ai.com","your key","your secret");IopRequest request =newIopRequest();// Adding this trial tag in header means using the trial resource to test, // please remove this ##trial tag after you purchased the APIrequest.addHeaderParameter("x-iop-trial","true")request.setApiName("/ai/image/cut/out");request.addApiParameter("simplify","true");//adding parameters as in the api doc we provide etc. I only listed one for examplerequest.addApiParameter("backGroundType","WHITE_BACKGROUND");request.addApiParameter("targetHeight","1000");request.addApiParameter("targetWidth","800");request.addApiParameter("imageUrl","https://ae01.alicdn.com/kf/Sa78257f1d9a34dad8ee494178db12ec8l.jpg");IopResponse response =client.execute(request,Protocol.GOP);System.out.println(response.getBody());
import iopclient = iop.IopClient("https://cn-api.aidc-ai.com", "your appKey", "your appSecret")request = iop.IopRequest('/ai/image/cut/out')request.set_protocol('GOP')##Adding this trial tag in header means using the trial resource to test, please remove this ##trial tag after you purchased the API
request.add_header("x-iop-trial","true")request.add_api_param('backGroundType', 'WHITE_BACKGROUND')request.add_api_param('targetHeight', '1000')request.add_api_param('targetWidth', '800')request.add_api_param('imageUrl', 'https://ae01.alicdn.com/kf/Sa78257f1d9a34dad8ee494178db12ec8l.jpg')response = client.execute(request)print(response.type)print(response.body)