路书 API
路书模块 api
路书GPX
获取路书的gpx文件, 响应以文件形式返回
GET
/openapi/v1/routes/<id>/gpx/
请求参数
参数 | 位置 | 含义 | 备注 |
---|---|---|---|
id | path | 路书id |
成功响应 HTTP 200
异常响应
找不到对应gpx文件 HTTP 404
获取用户收藏路书列表
获取用户收藏的路书列表
GET
/openapi/v1/routes/collects/
请求参数
参数 | 位置 | 含义 | 备注 |
---|---|---|---|
offset | query | 获取偏移量 | 从0开始 |
limit | query | 获取个数 | 从1开始,最大值为20 |
响应参数
字段名 | 类型 | 含义 | 备注 |
---|---|---|---|
count | 整型 | 总条数 | 返回用户收藏路书总数 |
previous | 字符串 | 上一页链接 | 没有上一页返回null |
next | 字符串 | 下一页链接 | 没有下一页返回null |
results | 数组 | 记录列表 | 没有数据返回空列表 |
id | 整型 | 路书id | |
distance | 整型 | 路书距离 | |
sport | 整型 | 运动类型 | 3: 骑行 |
title | 字符串 | 标题 | |
desc | 字符串 | 描述 | |
create_time | 整型 | 创建时间 | 时间戳(单位为ms) |
modify_time | 整型 | 更新时间 | 时间戳(单位为ms) |
响应示例
{
"count": 10,
"next": "https://example.com/next_page",
"previous": "https://example.com/previous",
"results": [
{
"id": 1,
"distance": 1200,
"sport": 3,
"title": "string",
"desc": "string",
"create_time": 1729565405000,
"modify_time": 1729595405000
}
]
}
获取用户创建路书列表
获取用户创建的路书列表
GET
/openapi/v1/routes/mine/
请求参数
参数 | 位置 | 含义 | 备注 |
---|---|---|---|
offset | query | 获取偏移量 | 从0开始 |
limit | query | 获取个数 | 从1开始,最大值为20 |
响应参数
字段名 | 类型 | 含义 | 备注 |
---|---|---|---|
count | 整型 | 总条数 | 返回用户收藏路书总数 |
previous | 字符串 | 上一页链接 | 没有上一页返回null |
next | 字符串 | 下一页链接 | 没有下一页返回null |
results | 数组 | 记录列表 | 没有数据返回空列表 |
id | 整型 | 路书id | |
distance | 整型 | 路书距离 | |
sport | 整型 | 运动类型 | 3: 骑行 |
title | 字符串 | 标题 | |
desc | 字符串 | 描述 | |
create_time | 整型 | 创建时间 | 时间戳(单位为ms) |
modify_time | 整型 | 更新时间 | 时间戳(单位为ms) |
响应样例
{
"count": 10,
"next": "https://example.com/next_page",
"previous": "https://example.com/previous",
"results": [
{
"id": 1,
"distance": 1200,
"sport": 3,
"title": "string",
"desc": "string",
"create_time": 1729565405000,
"modify_time": 1729595405000
}
]
}
获取路书导航json数据
获取路书导航数据,以json的格式返回
GET
/openapi/v1/routes/<id>/raw/
请求参数
参数 | 位置 | 含义 | 备注 |
---|---|---|---|
id | path | 路书id |
响应参数
字段名 | 类型 | 含义 | 备注 |
---|---|---|---|
id | 整型 | 路书id | |
name | 字符串 | 标题 | |
description | 字符串 | 描述 | |
distance | 整型 | 路书距离 | |
version | 字符串 | 2.0.0 | 常量 |
route_type | 整型 | 路书类型 | |
create_at | 整型 | 创建时间 | 时间戳(单位为ms) |
modify_at | 整型 | 更新时间 | 时间戳(单位为ms) |
elevation_gain | 浮点型 | 爬升 | 精度两位小数点 |
elevation_loss | 浮点型 | 落降 | 精度两位小数点 |
distances | 数组 | 距离数组 | 元素为浮点型 |
elevations | 数组 | 高程数组 | 元素为整型 |
polylines | 数组 | polyline对象数组 | |
steps | 数组 | step对象数组 | |
step.direction_source | 字符创 | 导航来源 | 如:google |
step.transport_type | 字符串 | 交通类型 | 如:bike |
step.instruction | 字符串 | 导航说明 | |
step.street_name | 字符串 | 街道名称 | |
step.maneuver | 整型 | 导航动作 | 参考google导航maneuver |
step.from | 整型 | 起始距离 | |
step.to | 整型 | 结束距离 | |
waypoints | 数组 | waypoint对象数组 | |
waypoint.name | 字符串 | waypoint标题 | |
waypoint.description | 字符串 | waypoint描述 | |
waypoint.elevation | 整型 | waypoint高程 | |
waypoint.distance | 浮点型 | waypoint距离 | |
waypoint.hidden | 布尔型 | 是否隐藏 | |
waypoint.function | 字符串 | 未知 | |
waypoint.coordinate | 数组 | 经纬度坐标 | [31.220055,120.381475] |
pois | 数组 | POI对象数组 | |
poi.latitude | 浮点型 | 纬度 | |
poi.longitude | 浮点型 | 经度 | |
poi.elevation | 整型 | 高程 | |
poi.create_time | 整型 | 创建时间 | 时间戳(单位为ms) |
poi.pic_url | 字符串 | 图片链接 | |
climbs | 数组 | 爬坡对象数组 | |
climb.category | 字符串 | 爬坡等级 | HC1234坡度 |
climb.start_index | 整型 | 开始爬坡位置索引 | |
climb.end_index | 整型 | 开始爬坡位置索引 | |
climb.max_grade | 浮点型 | 最大坡度 | (0, 1) |
climb.distance | 浮点型 | 爬坡距离 | |
climb.elevation_gain | 整数 | 爬升 | |
climb.score | 浮点型 | 未知 |
通用异常响应 Error Response
400
{
"code": 400,
"msg": "API Limited",
"data": {}
}
401
{
"code": 401,
"msg": "Unauthorized Error",
"data": {}
}
500
{
"code": 500,
"msg": "Server Error",
"data": {}
}