地址:https://open.cnipr.com/cnipr-api/v1/api/picture/pi6/{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 |
---|---|---|---|
此接口返回文件流,可直接用于<img>标签中 | stream |
public class SearchClientTest { String client_id = "CLIENT_ID"; String openid = "OPENID"; String access_token = "ACCESS_TOKEN"; /** * 获取专利插图路径接口,redirect方法 */ @Test public void expSerachTest() throws Exception { String url = "/v1/api/picture/pi6/"+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"));//资源id 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); // TODO httpClient.getConnectionManager().shutdown(); }