在向 CooServer 申请授权认证时,需要传用户名、密码参数,开发中需要使用公钥对密码进行 RSA 加密。
GET http://{server_url}:{server:port}/api/rsa/v1.0/public_key/{clientId}
| 参数 | 是否必须 | 说明 |
|---|---|---|
| clientId | 是 | 对接 CooServer 系统的账号 |
clientId 可在后台【系统设置】-【子系统管理】中查看:

正常情况下,会返回下述 JSON 数据包:
xxxxxxxxxx{ "retCode": 0, "msg": "请求成功", "data": "xxx"}
| 返回字段 | 说明 |
|---|---|
| retCode | 返回码,0 表示请求成功 |
| msg | 返回结果描述 |
| data | 公钥字符串 |
access_token 是 CooServer 的全局唯一接口调用凭据,调用 CooServer 各接口时都需使用access_token。开发者需要进行妥善保存。access_token的有效期目前为2个小时,需定时刷新,重复获取将导致上次获取的 access_token 失效。
xxxxxxxxxxPOST http://{server_url}:{server:port}/oauth/token
| 参数 | 是否必须 | 说明 |
|---|---|---|
| username | 是 | 用户名 |
| password | 是 | 用户密码,需要使用公钥对其 RSA 加密 |
| grant_type | 是 | 固定设为 password |
xpackage com.coorun.gis.config.security.filter;import javax.crypto.Cipher;import java.net.URLEncoder;import java.nio.charset.StandardCharsets;import java.security.KeyFactory;import java.security.interfaces.RSAPublicKey;import java.security.spec.X509EncodedKeySpec;import java.util.Base64;public class Demo { /** * 对字符串进行 rsa 加密 * * @param str 原始字符串 * @param publicKey 公钥字符串 * @return */ public static String encrypt(String str, String publicKey) { //base64编码的公钥 byte[] decoded = Base64.getDecoder().decode(publicKey); RSAPublicKey pubKey = null; String outStr = null; try { pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded)); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); outStr = URLEncoder.encode(Base64.getEncoder().encodeToString(cipher.doFinal(str.getBytes(StandardCharsets.UTF_8))), StandardCharsets.UTF_8.name()); } catch (Exception e) { e.printStackTrace(); } //RSA 加密 return outStr; }}
| 参数 | 是否必须 | 说明 |
|---|---|---|
| Authorization | 是 | Basic + 空格 + base64(客户端账号:客户端密码) |
正常情况下,会返回下述 JSON 数据包:
xxxxxxxxxx{ "access_token": "xxxx-xxx-xxx-xxx", "token_type": "bearer", "expires_in": 7199, "scope": "all"}
| 返回字段 | 说明 |
|---|---|
| access_token | 访问令牌 |
| token_type | 令牌类型 |
| expires_in | 过期时间,单位秒 |
| scope | 权限范围 |
获取当前登录用户的详细信息。
xxxxxxxxxxGET http://{server_url}:{server:port}/api/user/v1.0/info
| 参数 | 是否必须 | 说明 |
|---|---|---|
| access_token | 是 | 访问令牌 |
正常情况下,会返回下述 JSON 数据包:
xxxxxxxxxx{ "retCode": 0, "msg": "请求成功", "data": { "id": "xxx", "username": "xxx", "realName": "xxx", "remark": "xxx", "mobile": "xxx", "email": "xxx", "createTime": "2020-01-01 10:10:10", "updateTime": "2020-01-01 10:10:10" }}
| 返回字段 | 说明 |
|---|---|
| retCode | 返回码,0 表示请求成功 |
| msg | 返回结果描述 |
| data | 用户数据 |
| id | 用户 ID |
| username | 用户名 |
| realName | 真实姓名 |
| remark | 备注 |
| mobile | 手机号 |
| 邮箱 | |
| createTime | 创建时间 |
| updateTime | 更新时间 |
获取子系统的菜单列表,子系统的菜单可以在 CooRunServer 中【权限管理】-【资源管理】-【菜单管理】中选择对应的子系统后,进行添加。
xxxxxxxxxxGET http://{server_url}:{server:port}/api/menu/v1.0/list
| 参数 | 是否必须 | 说明 |
|---|---|---|
| oauthClientId | 客户端账号 | 客户端账号 |
| pid | 否 | 父菜单ID |
| access_token | 是 | 访问令牌 |
正常情况下,会返回下述 JSON 数据包:
xxxxxxxxxx{ "retCode": 0, "msg": "请求成功", "data": [ { "id": "xxx", "menuName": "xxx", "menuUrl": "", "menuIcon": "xxx", "pid": "xxx", "leaf": "0", "children": [ { "id": "xxx", "menuName": "xxx", "menuUrl": "xxx", "menuIcon": "xxx", "pid": "xxx", "leaf": "1", "children": [] } ] } ]}
| 返回字段 | 说明 |
|---|---|
| retCode | 返回码,0 表示请求成功 |
| msg | 返回结果描述 |
| data | 菜单数据 |
| id | 菜单 ID |
| menuName | 菜单名称 |
| menuUrl | 菜单 url |
| menuIcon | 菜单图标 |
| pid | 父菜单 ID |
| leaf | 是否为叶子节点,0 表示否,1表示是 |
| children | 子菜单列表 |
获取全部专题组织的树结构列表接口。
xxxxxxxxxxGET http://{server_url}:{server:port}/api/layer/v1.0/service_info
| 参数 | 是否必须 | 说明 |
|---|---|---|
| groupType | 否 | 专题组织类型(0:基础服务,1:专题服务) |
| access_token | 是 | 访问令牌 |
正常情况下,会返回下述 JSON 数据包:
xxxxxxxxxx{ "retCode": 0, "msg": "请求成功", "data": [ { "id": "xxx", "groupName": "xxx", "groupType": "xxx", "bizFlag": "xxx", "treeId": "xxx", "groupStatus": "x", "userId": "xxx", "username": "xxx", "orgId": "xxx", "createTime": "2020-01-01 10:10:10", "updateTime": "2020-01-01 10:10:10", "batchNumber": "xxx", "areaCode": "xxx", "list": [ { "id": "xxx", "bizId": "xxx", "layerId": "xxx", "createTime": "2020-01-01 10:10:10", "treeType": "x", "cid": "xxx", "pid": "xxx", "name": "xxx", "isParent": "x", "openOrClose": "x", "icon": "xxx", "serviceType": "x", "visible": "x", "orgId": "xxx" } ] } ]}
| 返回字段 | 说明 |
|---|---|
| retCode | 返回码,0 表示请求成功 |
| msg | 返回结果描述 |
| data | 专题组织数据 |
| id | 专题组织 ID |
| groupName | 专题组织名称 |
| groupType | 专题组织类型(0:基础,1:专题) |
| bizFlag | 业务标识 |
| treeId | 树结构 ID |
| groupStatus | 专题组织状态(0:停止,1:开启) |
| userId | 发布者 ID |
| username | 发布者名称 |
| orgId | 机构 ID |
| createTime | 创建时间,格式 yyyy-MM-dd HH:mm:ss |
| updateTime | 更新时间,格式 yyyy-MM-dd HH:mm:ss |
| batchNumber | 批次号 |
| areaCode | 区域编码 |
| list | 专题组织树结构 |
| id | 树节点 ID |
| bizId | 业务 ID |
| layerId | 图层资源 ID |
| createTime | 创建时间,格式 yyyy-MM-dd HH:mm:ss |
| treeType | 树类型(0:批次发布,1:手动组织) |
| cid | 子节点 ID |
| pid | 父节点 ID(-1 为顶层节点) |
| name | 节点名称 |
| isParent | 是否为文件夹(0:否,1:是) |
| openOrClose | 样式开合(0:合起,1:开启) |
| icon | 图标路径 |
| serviceType | 节点服务类型 |
| visible | 是否默认显示(0:否,1:是) |
| orgId | 机构 ID |
根据图层 ID 和 access_token,获取三维图层服务数据。
xxxxxxxxxxGET http://{server_url}:{server:port}/api/layer/v1.0/layer_info
| 参数 | 是否必须 | 说明 |
|---|---|---|
| resource_id | 是 | 图层 ID |
| access_token | 是 | 访问令牌 |
xxxxxxxxxx{ "retCode": 0, "msg": "请求成功", "data": { "id": "xxx", "bizKey": "xxx", "userId": "xxx", "serviceName": "xxx", "serviceType": "xxx", "dataServerHost": "xxx", "dataPath": "xxx", "areaCode": "xxx", "dataTime": "20200101", "publishType": "x", "serviceStatus": "x", "username": "xxx", "orgId": "xxx", "createTime": "2020-01-01 10:10:10", "updateTime": "2020-01-01 10:10:10", "dataTypeCode": "xxx", "batchNumber": "xxx", "list": [ { "id": "xxx", "bizKey": "xxx", "serviceName": "xxx", "path": "xxx", "compressed": "x", "c3s": "x", "createTime": "2020-01-01 10:10:10" } ], "attr": [ { "id": "xxx", "bizKey": "xxx", "attrType": "x", "attrKey": "xxx", "attrValue": "xxx", "attrStatus": "x", "attrRank": x, "attrPrivilege": x, "serviceType": "xx" } ] }}
| 返回字段 | 说明 |
|---|---|
| retCode | 返回码,0 表示请求成功 |
| msg | 返回结果描述 |
| data | 三维图层服务数据 |
| id | 三维图层服务 ID |
| bizKey | 业务标识 |
| userId | 用户 ID |
| serviceName | 服务名 |
| serviceType | 服务类型(GMS、OSGB、DOM、DEM、BIM等) |
| dataServerHost | 文件服务器地址 |
| dataPath | 数据绝对路径 |
| areaCode | 区域编码 |
| dataTime | 数据生产的时间,格式:yyyyMMdd |
| publishType | 发布方式(0:单条发布,1:批量发布,2:第三方服务) |
| serviceStatus | 服务状态(0:停止,1:开启) |
| username | 发布者名称 |
| orgId | 发布的机构 |
| createTime | 服务创建时间,格式 yyyy-MM-dd HH:mm:ss |
| updateTime | 服务更新时间,格式 yyyy-MM-dd HH:mm:ss |
| dataTypeCode | 数据类型 |
| batchNumber | 批次编号 |
| list | 三维图层数据列表 |
| id | 三维图层数据 ID |
| bizKey | 业务标识 |
| serviceName | 服务名称 |
| path | 图层数据路径 |
| compressed | 是否压缩(0:否,1:是) |
| c3s | 是否为c3s(0:否,1:是) |
| createTime | 创建时间,格式 yyyy-MM-dd HH:mm:ss |
| attr | 属性信息列表 |
| id | 属性信息 ID |
| bizKey | 业务标识 |
| attrType | 属性类型(0:基础属性,1:扩展属性) |
| attrKey | 属性名称 |
| attrValue | 属性值 |
| attrStatus | 状态(0:停用,1:启用) |
| attrRank | 排序 |
| attrPrivilege | 权重 |
| serviceType | 服务类型(GMS、OSGB、DOM、DEM、BIM等) |
根据图层 ID 和 access_token,获取二维图层服务数据。
xxxxxxxxxxGET http://{server_url}:{server:port}/api/layer/v1.0/vector_info
| 参数 | 是否必须 | 说明 |
|---|---|---|
| resource_id | 否 | 专题组织类型(0:基础服务,1:专题服务) |
| access_token | 是 | 访问令牌 |
xxxxxxxxxx{ "retCode": 0, "msg": "请求成功", "data": { "id": "xxx", "bizKey": "xxx", "userId": "xxx", "serviceUrl": "xxx", "serviceName": "xxx", "ename": "xxx", "serviceStatus": "x", "dataSource": "x", "dataType": "x", "workSpace": "xxx", "uniqueField": "xxx", "areaCode": "xxx", "bizFlag": "x", "topic": "xxx", "dataTime": "20200191", "username": "xxx", "orgId": "xxx", "createTime": "2020-01-01 10:10:10", "updateTime": "2020-01-01 10:10:10", "ogcType": "x" }}
| 返回字段 | 说明 |
|---|---|
| retCode | 返回码,0 表示请求成功 |
| msg | 返回结果描述 |
| data | 二维图层服务数据 |
| id | 二维图层服务 ID |
| bizKey | 业务标识 |
| userId | 用户 ID |
| serviceUrl | 服务地址 |
| serviceName | 服务名 |
| ename | 服务别名 |
| serviceStatus | 服务状态(0:停止,1:开启) |
| dataSource | 数据来源(0:arcgis,1:geoserver) |
| dataType | 数据类型(0:点,1:线,2:面) |
| workSpace | 工作区 |
| uniqueField | 二维服务获取属性的必填字段 |
| areaCode | 区域编码 |
| bizFlag | 业务字段 |
| topic | 是否配置专题(0:否,1:是) |
| dataTime | 数据生产的时间,格式 yyyyMMdd |
| username | 发布者名称 |
| orgId | 发布的机构 |
| createTime | 创建时间,格式 yyyy-MM-dd HH:mm:ss |
| updateTime | 更新时间,格式 yyyy-MM-dd HH:mm:ss |
| ogcType | ogc类型(0:wms,1:wfs,2:wmts) |