地址:https://open.cnipr.com/cnipr-api/v1/api/picture/pi16/{client_id}
HTTP GET
| 参数名称 | 说明 | 参数类型 | 是否必须 | 类型 | schema |
|---|---|---|---|---|---|
| client_id | 应用ID,注册应用时的client_id | path | true | string | |
| openid | 用户ID,获取方式参见:第三方获取用户授权 | query | false | string | |
| access_token | 访问令牌,获取方式参见:第三方获取用户授权 | query | false | string | |
| pid | 公开(公告)号 | query | true | string | |
| resource_name | 图片名称(样例:HDA0000470672130000011.GIF) | query | true | string |
| 参数名称 | 说明 | 类型 | schema |
|---|---|---|---|
| status | 状态码,0代表成功,其它值含义见附录 | int64 | |
| message | 静态资源路径 | string |
public class SearchClientTest {
String client_id = "CLIENT_ID";
String openid = "OPENID";
String access_token = "ACCESS_TOKEN";
/**
* 获取专利插图路径接口,返回资源路径
*/
@Test
public void expSerachTest() throws Exception {
String url = "/v1/api/picture/pi15/"+client_id;
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
// 提交参数及值
nvps.add(new BasicNameValuePair("openid", openid));
nvps.add(new BasicNameValuePair("access_token", access_token));
nvps.add(new BasicNameValuePair("pid", "CN103914738A"));//公开(公告)号
nvps.add(new BasicNameValuePair("resource_name", "HDA0000470672130000011.GIF"));//图片名称
this.get(url, nvps);
}
public void get(String url, List<NameValuePair> nvps) throws Exception {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
String str = EntityUtils.toString(new UrlEncodedFormEntity(nvps,"UTF-8"));
httpGet.setURI(new URI(httpGet.getURI().toString() + "?" + str));
HttpResponse response = httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
String ss = EntityUtils.toString(entity, "UTF-8");
//打印返回结果
System.out.println(ss);
EntityUtils.consume(entity);
httpClient.getConnectionManager().shutdown();
}