地址:https://open.cnipr.com/cnipr-api/rs/api/analysis/as12/{client_id}
HTTP POST
参数名称 | 参数说明 | 是否必填 | 参数类型 |
---|---|---|---|
client_id | 应用id,如没有clientId请先接入应用,查看接入流程获取 | true | String |
openid | 用户id,可通过 Implicit Grant 方式 或 Authorization Code 方式 等两种方式获取openid | true | String |
access_token | 访问令牌,可通过
Implicit Grant 方式 或
Authorization Code 方式或
Refresh Token 方式
等三种方式获取access_token |
true | String |
exp | 检索表达式,例:来源=农业农村部 可用字段参考字段说明 | true | String |
senior | 高级检索表达式 | false | String |
option | 检索类型,默认值:2 (按字检索)其它值含义见附录 | false | int |
from | 返回值起始坐标,默认为0,不能为负数。from:0表示从第1条开始取数据 | true | int |
size | 统计结果集,上限为10000,默认为10 | false | int |
analysis | 聚类分析字段, 仅一级字段可参与检索,可用字段参考聚类分析字段 | true | String |
filter | 过滤字段 | false | List<String> |
sort | 排序字段,SortByKeyAsc 按分析字段升序;SortByKeyDesc 按分析字段降序;默认为 None 按统计值降序 | false | 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 = "/rs/api/analysis/as12/"+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("exp", "来源=农村部")); nvps.add(new BasicNameValuePair("from", "0")); //from:0,表示从第1条开始取,不能为负数 nvps.add(new BasicNameValuePair("size", "10")); //size:10,表示取10条,上限为100条,不能为负数 nvps.add(new BasicNameValuePair("option", "2")); nvps.add(new BasicNameValuePair("analysis", "pkd"));//品种 // nvps.add(new BasicNameValuePair("filter", "")); // nvps.add(new BasicNameValuePair("sort", "SortByKeyAsc")); this.POST(url, nvps); } public void POST(String url, List<NameValuePair> nvps) throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); httppost.setHeader("ContentType", "application/x-www-form-urlencoded"); // 设置表单提交编码为UTF-8 UrlEncodedFormEntity entry = new UrlEncodedFormEntity(nvps, "UTF-8"); entry.setContentType("application/x-www-form-urlencoded;charset=UTF-8"); httppost.setEntity(entry); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); String ss = EntityUtils.toString(entity, "UTF-8"); //打印返回结果 System.out.println(ss); EntityUtils.consume(entity); httpclient.getConnectionManager().shutdown(); } }
英文名称 | 中文名称 | 类型 |
---|---|---|
opttime | 更新日期 | String |
ds | 来源 | String |
pans | 申请号 | String |
pkd | 种类 | String |
pnm | 名称 | String |
属性名称 | 属性说明 | 属性类型 |
---|---|---|
status | 状态码,0代表成功,其它值含义见附录 | long |
message | 响应的信息描述 | String |
total | 命中总数 | long |
results | 聚类分析结果集 | List<AnalysisBean> |
AnalysisBean
属性名称 | 属性说明 | 属性类型 |
---|---|---|
analysisTotal | 聚类分析总条数 | int |
analysisCol | 聚类分析字段名(英文) | string |
analysisName | 聚类分析字段名(中文) | string |
analysisFrom | 聚类分析取值起始游标值 | int |
analysisSize | 聚类分析取值数量 | int |
list | 聚类分析详细 | List<KeyValueBean> |
KeyValueBean
属性名称 | 属性说明 | 属性类型 |
---|---|---|
key | 聚类值 | string |
value | 聚类数量 | int |