簽名添加/修改接口,支持同一請(qǐng)求傳多次license_url或license_base64參數(shù),以實(shí)現(xiàn)上傳多個(gè)證明文件的需求。
以下為添加簽名接口license_url傳多次的代碼示例:
public static void main(String[] args) throws Exception {
String url = "http://sms.yunpian.com/v2/sign/add.json";
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("sign", "云片測(cè)試"));
params.add(new BasicNameValuePair("website", "http://www.ssjdyy2.com"));
params.add(new BasicNameValuePair("license_url", "http://xxx1.jpg"));
params.add(new BasicNameValuePair("license_url", "http://xxx2.jpg"));
params.add(new BasicNameValuePair("apikey", "xxx"));
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
try (CloseableHttpResponse response = client.execute(httpPost)) {
String responseBody = EntityUtils.toString(response.getEntity(), "UTF-8");
System.out.println(responseBody);
}
} catch (Exception e) {
e.printStackTrace();
}
}