API 列表
| 请求方式 |
API |
描述 |
| GET |
/v1.0/osaas/locations |
获取位置列表 |
| GET |
/v1.0/osaas/locations/{location_id} |
获取位置详情 |
获取位置列表
接口描述
调用该接口获取位置列表
接口地址
GET /v1.0/osaas/locations
请求参数
| 参数名 |
类型 |
参数类型 |
说明 |
是否必需 |
| parent_location_id |
String |
URL |
位置父级唯一标识,中国:0;获取国际地区:-1 |
是 |
响应参数
| 参数名 |
类型 |
说明 |
| code |
Integer |
响应码(详情见错误码章节),成功时为空 |
| success |
Boolean |
是否成功:(true:成功,false:失败) |
| msg |
String |
请求失败的信息,成功时为空 |
| t |
Long |
返回时间戳,13位 |
| result |
Array |
地理位置列表 |
result参数说明
| 参数名 |
类型 |
说明 |
| location_id |
String |
位置唯一标识 |
| name |
String |
位置名称 |
| parent_location_id |
String |
父级唯一标识 |
| level |
Integer |
层级 |
请求示例
GET {url}/v1.0/osaas/locations?parent_location_id=-1
响应成功示例
{
"result": [
{
"location_id": "0",
"level": 0,
"name": "中国",
"parent_location_id": "-1"
}
],
"success": true,
"t": 1586229786371
}
响应失败示例
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
获取位置详情
接口描述
调用该接口获取位置详情
接口地址
GET /v1.0/osaas/locations/{location_id}
请求参数
| 参数名 |
类型 |
参数类型 |
说明 |
是否必需 |
| location_id |
String |
URI |
位置唯一标识 |
是 |
响应参数
| 参数名 |
类型 |
说明 |
| code |
Integer |
响应码(详情见错误码章节),成功时为空 |
| success |
Boolean |
是否成功:(true:成功,false:失败) |
| msg |
String |
请求失败的信息,成功时为空 |
| t |
Long |
返回时间戳,13位 |
| result |
Object |
返回结果 |
result参数说明
| 参数名 |
类型 |
说明 |
| location_id |
String |
位置唯一标识 |
| name |
String |
位置名称 |
| parent_location_id |
String |
父级唯一标识 |
| level |
Integer |
层级 |
请求示例
GET {url}/v1.0/osaas/locations/11
响应成功示例
{
"success": true,
"t": 1566053034624,
"result": {
"level": 1,
"name": "北京市",
"location_id": "11",
"parent_location_id": "0"
}
}
响应失败示例
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
错误码
以下为该接口常见的业务异常,更多的异常错误,请参见全局错误码。