API 文档
GPS 数据接收接口说明与快速接入指南
快速开始
1
获取 API 密钥
在管理后台生成您的专属 API 密钥,用于接口认证
2
配置数据发送端
在您的 GPS 设备或数据发送系统中配置 API 端点地址和认证信息
3
发送测试数据
使用下方提供的示例代码发送测试数据,验证连接是否正常
4
查看监控台
登录监控台查看实时接收的 GPS 定位数据和设备状态
接口端点
基础信息
请求 URL:
POST /api/v1/gps/submitContent-Type:
application/json认证方式:
Bearer Token请求头
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| Authorization | string | 是 | Bearer {your_api_key} |
| Content-Type | string | 是 | application/json |
请求体
| 字段名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| deviceId | string | 是 | 设备唯一标识符 |
| latitude | number | 是 | 纬度坐标(WGS84) |
| longitude | number | 是 | 经度坐标(WGS84) |
| timestamp | string | 否 | 时间戳(ISO 8601 格式,默认使用服务器时间) |
| accuracy | number | 否 | 定位精度(米) |
| altitude | number | 否 | 海拔高度(米) |
代码示例
cURL
curl -X POST https://api.example.com/api/v1/gps/submit \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"deviceId": "DEV001",
"latitude": 39.9042,
"longitude": 116.4074,
"accuracy": 2.5,
"altitude": 50.0
}'JavaScript
const response = await fetch('https://api.example.com/api/v1/gps/submit', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
deviceId: 'DEV001',
latitude: 39.9042,
longitude: 116.4074,
accuracy: 2.5,
altitude: 50.0
})
});
const result = await response.json();
console.log(result);Python
import requests
url = 'https://api.example.com/api/v1/gps/submit'
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
'deviceId': 'DEV001',
'latitude': 39.9042,
'longitude': 116.4074,
'accuracy': 2.5,
'altitude': 50.0
}
response = requests.post(url, headers=headers, json=data)
print(response.json())响应格式
成功响应(200 OK)
{
"success": true,
"code": 200,
"message": "数据接收成功",
"data": {
"recordId": "rec_1234567890",
"receivedAt": "2026-06-15T10:30:45Z"
}
}错误响应
{
"success": false,
"code": 400,
"message": "参数错误:缺少必填字段 latitude",
"error": "INVALID_PARAMS"
}常见错误码:
400 - 参数错误 | 401 - 认证失败 | 403 - 权限不足 | 429 - 请求超限 | 500 - 服务器错误
注意事项
- •请妥善保管 API 密钥,不要泄露给第三方
- •建议使用 HTTPS 协议加密传输数据
- •单个设备建议控制发送频率不超过 1 次/秒
- •坐标格式请使用 WGS84 标准