地址:https://open.cnipr.com/cnipr-api/v1/api/cocave/co1/{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 | 检索表达式,例:标准号=GB 10080-2001 表达式能够拼写字段见 CatalogueDto说明字段 |
true | String |
orders | 排序字段,字段前加+号表示升序,加-号表示降序。多个字段排序以逗号分隔,优先级按字段先后顺序。 使用示例:+declareDate表示公告日期升序,-declareDate表示公告日期降序; | false | List<String> |
from | 返回值起始坐标,默认为0,不能为负数。from:0表示从第1条开始取数据 | true | int |
size | 检索结果集数,上限为100,默认为10 | true | String |
queryType | 检索类型,默认值:2 (按字检索)其它值含义见附录 | false | int |
returnValues | 检索返回字段,多个字段以逗号分隔。未填写则返回默认字段。字段描述见 CatalogueDto属性名称字段 | true | String[] |
exp:标准号=GB 10080-2001 orders:+declareDate queryType:2 from:0 size:10
public class SearchClientTest { String access_token = "ACCESS_TOKEN"; String openid = "OPENID"; String client_id = "CLIENT_ID"; /** * 标准数据检索接口 */ @Test public void expSerachTest() throws Exception { String url = "/v1/api/cocave/co1/"+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", "标准号=GB 10080-2001")); nvps.add(new BasicNameValuePair("orders", "+declareDate")); nvps.add(new BasicNameValuePair("from", "0")); //from:0,表示从第1条开始取,不能为负数 nvps.add(new BasicNameValuePair("size", "10")); //size:10,表示取10条,上限为50条,不能为负数 nvps.add(new BasicNameValuePair("queryType", "2")); nvps.add(new BasicNameValuePair("returnValues", "adoptDesc,adoptLevel,adoptNo,bookNo,ccs,colorPageNum,committeeDesc,declareDate,downPrintPrice,draftsDept,draftsMan, electronicDownLoadPrice,electronicPrintPrice,format,haveColor,haveElectronic,havePaper,ics,issueDate,issueDepart,languages,materialDate, modiDate,obsoleteDate,ownerDept,paperPublishDate,paperSalePrice,preViewPage,publishseq,referStandNo,remark,replaceNum,replaceStand, replacedStand,saleStatus,standClass,standName,standNo,standNum,standPreNo,standStatus,standType,standYearNum,sueDepart,totalPages")); 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(); } }
属性名称 | 属性说明 | 属性类型 |
---|---|---|
status | 状态码,0代表成功,其它值含义见附录 | long |
message | 响应的信息描述 | String |
total | 命中总数 | long |
from | 检索起始位 | int |
size | 检索数量 | int |
results | 检索结果集 | List<CatalogueDto> -- 数据详细 |
CatalogueDto
属性名称 | 说明 | 类型 |
---|---|---|
adoptDesc | 采标名称 | string[][] 数组二维位置固定为原文、中文、英文 |
adoptLevel | 采用程度 | string |
adoptNo | 采用标准 | string[][] 数组二维位置固定为原文、中文、英文 |
bookNo | 书号 | string |
ccs | 中标分类号 | List<String> |
colorPageNum | 彩页数 | string |
committeeDesc | 标准技术委员会 | string[][] 数组二维位置固定为原文、中文、英文 |
declareDate | 公告日期 | string |
downPrintPrice | 下载打印定价 | string |
draftsDept | 起草单位 | string[][] 数组二维位置固定为原文、中文、英文 |
draftsMan | 起草人 | string[][] 数组二维位置固定为原文、中文、英文 |
electronicDownLoadPrice | 电子版下载定价 | string |
electronicPrintPrice | 电子版打印定价 | string |
format | 开本 | string |
haveColor | 有无彩色图片 | string |
haveElectronic | 有无电子版 | string |
havePaper | 有无纸质版 | string |
ics | 标准ICS号 | List<String> |
issueDate | 发布日期 | string |
issueDepart | 发布单位 | string[][] 数组二维位置固定为原文、中文、英文 |
languages | 出版语种 | string |
materialDate | 实施日期 | string |
modiDate | 修订日期 | string |
obsoleteDate | 作废日期 | string |
ownerDept | 适用范围 | string[] 数组位置固定为原文、中文、英文 |
paperPublishDate | 纸质版出版日期 | string |
paperSalePrice | 纸质版定价 | string |
preViewPage | 文前页 | string |
publishseq | 版次 | string |
referStandNo | 引用标准 | List<String> |
remark | 备注 | string |
replaceNum | 替代个数 | string |
replaceStand | 替代标准 | List<String> |
replacedStand | 被替代标准 | List<String> |
saleStatus | 可售标记 | string |
standClass | 标准类别 | string |
standName | 标准名称 | string[] 数组位置固定为原文、中文、英文 |
standNo | 标准号 | string |
standNum | 标准编号 | string |
standPreNo | 标准代号 | string |
standStatus | 标准状态 | string |
standType | 标准属性 | string |
standYearNum | 标准年代号 | string |
sueDepart | 提出部门 | string[][] 数组二维位置固定为原文、中文、英文 |
totalPages | 总页数 | string |