签名添加/修改接口,支持同一请求传多次license_url或license_base64参数,以实现上传多个证明文件的需求。
以下为添加签名接口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", "云片测试"));
params.add(new BasicNameValuePair("website", "https://www.yunpian.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();
}
}