概述

目前我们已为第三方开发者提供位置+视频开放能力,帮助开发者快速获取设备基本信息、设备最新位置信息、设备历史轨迹、打开设备摄像头,实时查看设备视频画面、调取设备历史视频等能力。


用户登录

第三方开发者在调用各类开放能力时时,首先要通过开放平台的鉴权认证,为其分配有效的访问token后,才可授权调用其它能力接口

  • 接口名称:userlogin

  • 请求方式:POST

  • 请求参数:

header参数:

字段 类型 必填 说明
AppKey string true AppKey由我司商务提供

body参数:

字段 类型 必填 说明
mobile string true 用户名(一般为注册手机号码)
pwd string true 登录密码(须MD5加密提交,32位、大写)
logintype int true 登录类型,缺省填0即可
platform string false 平台类型。简要描述即可,如例子中的“第三方”
devicetoken string true 设备识别号,接入IP等。可以填设备的IMEI,IP等,可填空字符串。
version string true 应用版本号。简要描述下版本号,如:1.0.0.1
packname string true 包名 com.mapgoo.chedaibao
flag int false 是否返回所有设备自编号和流量卡号,1:不返回,0(缺省):返回
  • 返回参数:
字段 类型 说明
authtoken string 授权token,在请求以后的接口中需要填写到请求头的Authorization属性
userid int 用户ID
username string 用户名称
objectid Array 该账号下所有设备自编号
holdid int 用户渠道号
holdname string 用户渠道名称
  • 请求示例:
  • http://192.168.100.96/ 为测试URL,线上URL请联系商务人员
curl http://192.168.100.96/v4/api/userlogin -X POST
-H "AppKey: 0f28b5d49b3020afeecd95b4009adf4a"
-d "
{
    "mobile": "test",
    "logintype": 0,
    "platform": "第三方",
    "packname":"com.mapgoo.chedaibao.mgkj",
    "pwd": "e10adc3949de59abbe543557f20f883e",
    "devicetoken":"",
    "version":"1.0.0",
    "flag": 1
}
"
  • 返回示例:
{
    "error": 0,
    "reason": "OK",
    "result": {
        "userid": 375794,
        "userCode": null,
        "username": "测试账号",
        "avatar": "",
        "mobile": "",
        "company": "",
        "userTitle": "出行",
        "authtoken": "96C20E37949AF0CB17784B6964813F38",
        "unionid": null,
        "logincount": 8697,
        "logindate": "2020-01-02 18:56:07",
        "isdata": 1,
        "objectid": [
            "201790066"
        ],
        "sim": [
            "1440322100158"
        ],
        "ssvid": null,
        "shareurl": "http://d.u12580.com/snow/",
        "qrcode": "http://app056.u12580.com/snow_v4/img/other/14080634221.png",
        "passwordtip": 0,
        "holdid": 149683,
        "holdname": "江铃易至出行",
        "logintype": 0,
        "posshareurl": "http://wechat.u12580.com/ui/tracks/positionshare1.html",
        "buyurl": "http://www.mapgoo.net",
        "userType": "951",
        "holdLastUpdateTime": "2020/1/2 15:03:36",
        "funIDS": "500000,500100,500200,500201,500202,500203,500204,500205,5274",
        "loginflag": 1
    }
}

  • 给其他接口head使用,例如:
Authorization:E6191BC14C20A4B8CE5D91BADD6D6977

设备信息

查询终端信息

  • 接口名称:device/getinfo
  • 请求方式:GET
  • 请求参数:
字段 类型 必填 说明
id string true Imei号或者设备编号
  • 返回参数:
字段 类型 说明
ObjectName string 车牌号
ObjectID string 设备ID
Imei string Imei号
ActiveTime Date 激活日期
ExpireTime Date 服务过期日期
SPeriod string 服务周期
State string 终端当前服务状态
MdtType string 终端类型
  • 请求示例:
curl http://192.168.100.96/api/device/getinfo?id=805668625060347 

设备位置

查询终端位置信息

  • 接口名称:GetSimpleObjectTracks
  • 请求方式:GET
  • 请求参数:
字段 类型 必填 说明
objectid string true ID号(登录时返回,或者查询终端信息得到)
flag int false 是否进行地址解析,1:解析(默认),0:不解析
  • 返回参数:
字段 类型 说明
TransType int 是否在线,0:不在线, 1:在线
gpsFlag int 当前定位标志:307/308:GPS 318:基站定位
posmode string 当前定位模式,gpsFlag的文字描述
Lon float 经度
Lat float 纬度
BDLon float 经度(百度坐标)
BDLat float 纬度(百度坐标)
Speed int 速度
Direct int 方向
RcvTime date 数据接收时间
GPSTime Date 定位时间
ObjectName string 目标名称
sim string 设备中安装的sim卡号
imei string 设备识别号
gpsLocatinAddr string 所在位置(根据Flag决定是否解析出文字描述)
DeviceState int 0:库存 1:未使用 2:已安装 3:拆机 4:报修
MDTTypeStatus int 0:有线设备 1:无线设备
State int 设备运营状态 0,1:正常 2,3:未开通 4,5:过期 6:报停 7,8:未使用
statusDes string 设备状态描述,如“待命,位置上报”
dayMileage double 当日行驶里程
mileage double 总里程
isstopState string 启动/熄火
startTime string isStopStateType=0时有效,表示启动时间(运动时长可以使用当前时间和此字段的差值计算),无效时请填写默认值:1970-01-01 08:00:00
stopTime string isStopStateType=1时有效,表示熄火时间(静止时长可以使用当前时间和此字段的差值计算),无效时请填写默认值:1970-01-01 08:00:00
  • 请求示例:
  • http://192.168.100.96/为测试URL,线上URL请联系商务人员
curl http://192.168.100.96/api/GetSimpleObjectTracks?objectid=123

设备轨迹

查询终端位置信息

  • 接口名称:HistoryTracks
  • 请求方式:GET
  • 请求参数:
字段 类型 必填 说明
objectId string true ID号(登录时返回)
carno string true 车牌号码,可以为空字符
imei string false IMEI,以上三个字段的值只能选填一个,即要么根据ObjectID,要么根据车牌号码,要么根据imei查询
speed_limit int true 速度过滤,小于该值的轨迹进行过滤,-1:不过滤
exact int false 是否过滤基站数据,-1:不过滤,0:过滤
topic int false 最近行程轨迹,0:按时间段,5:最近5笔;
stime string true 开始时间
etime string true 结束时间
  • 返回参数:
字段 类型 说明
id int 序号
lon float 经度
lat float 纬度
rlon float 经度(百度)
rlat float 纬度(百度)
speed int 速度
direct int 方向
gpstime Date GPS 时间
rcvtime Date 接收时间
mile float 当前里程
status string 状态说明
posmode string 定位模式
  • 请求示例

  • http://192.168.100.96/为测试URL,线上URL请联系商务人员

curl http://192.168.100.96/api/HistoryTracks?objectId=381254&carno=&stime=2016-01-19%201:00:00&etime=2016-01-19%2015:00:00

录音列表

第三方平台查询设备录音列表接口

  • 接口名称:GetRecFileList
  • 请求方式:GET
  • 请求参数:
字段 类型 必填 说明
seq string false 指令流水号,备用
objectID int true 设备id
startTime string true 开始时间
endTime string true 结束时间
pageNum int true 页码
pageSize int true 页大小
fileFormat string true aac格式
  • 返回参数:
字段 类型 必填 说明
error int true 0-成功 非0-失败
total int true 总目录条数
indexID long true 流水号
localFilePath string false 设备本地视频文件路径
fileFormat string false 文件格式
fileSize int false 文件大小,单位:kb
cloudUrl string false 云文件路径
FileModifyTime string false 文件修改时间
  • 请求示例:
  • http://192.168.100.96/为测试URL,线上URL请联系商务人员
curl http://192.168.100.96/api/GetRecFileList?objectID=123&startTime=2019-10-01 05:01:02&endTime=2019-10-02 15:01:02&pageNum=1&pageSize=20&fileFormat=acc

获取音频

第三方平台查询设备录音列表接口

  • 接口名称:GetRecFileUrl
  • 请求方式:GET
  • 请求参数:
字段 类型 必填 说明
indexID string true 记录ID
objectID int true 设备ID
seq string false 指令流水号,备用
  • 返回参数:
字段 类型 必填 说明
error int true 0-成功 非0-失败
reason string true 失败原因。只有失败时才有
cloudUrl string false 云文件路径

视频时间轴

第三方平台获取远程调阅拉取时间轴。备注说明:暂未实现。

  • 接口名称:getTimeLines
  • 请求方式:GET
  • 请求参数:
字段 类型 必填 说明
objectID int true 设备ID
sourceType int true 数据来源:1终端设备 2云端
beginTime string true 时间轴的开始时间,格式yyyy-MM-dd HH:mm:ss
endTime string true 时间轴的结束时间,格式yyyy-MM-dd HH:mm:ss
  • 返回参数:
字段 类型 必填 说明
error int true 0-成功 非0-失败
reason string true 失败原因。只有失败时才有
objectID int true 调阅的设备ID
imei string false 调阅的设备的IMEI
channel int true 摄像头channel编号,从0开始计算
startTime string true 视频文件的开始时间(yyyy-MM-dd HH:mm:ss)
endTime string true 视频文件的结束时间(yyyy-MM-dd HH:mm:ss)
sourceType string true 数据来源:1终端设备 2云端
  • 请求示例:
curl http://192.168.100.96/api/cloudStorage2b/getTimeLines?objectID=201576343&sourceType=1&beginTime=2019-11-2500:00:00&endTime=2019-11-25 23:59:59

发起调阅

第三方平台发起远程调阅请求。备注说明:暂未实现。

  • 接口名称:remotePlay
  • 请求方式:GET
  • 请求参数:
字段 类型 必填 说明
objectID int true 设备ID
channel int true 摄像头channel编号
beginTime string true 播放的开始时间,格式yyyy-MM-dd HH:mm:ss
sourceType string int 数据来源:1终端设备 2云端
  • 返回参数:
字段 类型 必填 说明
error int true 0-成功 非0-失败
reason string true 失败原因。只有失败时才有失败原因。
playId string true 远程调阅唯一编号
playUrl string true 远程调阅拉流URL地址
  • 请求示例:
  • http://192.168.100.96/为测试URL,线上URL请联系商务人员
curl http://192.168.100.96/api/remotePlay?objectID=201576343&channel=0&sourceType=1&beginTime=2019-11-25 10:02:26

更新设备信息

第三方更新设备信息,把设备移到指定的车牌下。备注说明:暂未实现。

  • 接口名称:vehicle/sync
  • 请求方式:POST
  • 请求参数:
字段 类型 必填 说明
imei string true 设备imei
dest_hold_name string true 设备的目标hold的名称
device_name string true 设备名称、车牌号
car_no string true 车牌号,车辆唯一识别号
contactor string true 司机姓名
contact_num string true 司机电话号码
remark string false 备注司机身份证号码
  • 返回参数:
字段 类型 必填 说明
error int true 0-成功 非0-失败
reason string true 失败原因。只有失败时才有失败原因。
  • 请求示例:
  • http://192.168.100.96/为测试URL,线上URL请联系商务人员
curl http://192.168.100.96/api/device/sync -X POST -d "
{
    "imei": "123456789",
    "dest_hold_name":"YZ自营",
    "device_name": "赣AD1234",
    "contactor": "张三",
    "contact_num":"13813800138",
    "remark": "360122197006102014"
}
"

实时信息推送

实时(报警开始和结束、位置变更)信息推送。设备有报警和位置信息需要推送时,由我司调用该接口将信息同步给合作方。

  • 接口名称:active/push

  • 请求方式:POST

  • 请求参数:

字段 类型 必填 说明
data Object true 数据内容,根据不同dataType不同
dataType string true 推送消息类型,目前支持两种类型:报警推送为“Alarm”,位置推送为“Location”
objectID int true 设备ID号
  • 报警开始推送data内容字段
字段 类型 必填 说明
alarmID Long true 报警编号
alarmDesc string true 报警描述
alarmTime string true 报警时间
alarmType string true 报警类型中文名称
alarmTypeID string true 报警类型编号
direct string true 方向
lat string true 纬度
lon string true 经度
objectName string true 设备名称
polygonID string true 编栏编号,如电子围栏或者行政区域
speed string true 速度
state string true 报警状态,0:报警开始, 1:报警结束
AlarmTypeID 说明
1002 断电报警
1004 碰撞报警
1006 低电压报警
1012 位移
1013 超速报警
1040 进围栏报警
1041 出围栏报警
1051 超速
1055 进行政区域报警
1056 出行政区域报警
1111 进二押点报警
1112 二押停留报警
1113 二押久留报警
1114 光感报警
1115 磁感报警
1116 拆除报警
1117 疑似屏蔽报警
1120 长期离线上线提醒
1121 上电提醒
1122 GPS分离报警
1123 聚集报警
1130 反欺诈
  • 报警开始请求示例:
curl http://url/api/active/push -X POST -d "
{
    "data": {
        "alarmID": "3830",
        "alarmInfo": {
            "alarmDesc": "位移",
            "alarmTime": "2016-11-24 14:16:28",
            "alarmType": "位移",
            "alarmTypeID": "1012",
            "direct": "0",
            "lat": "22.6995049715042",
            "lon": "109.263516664505",
            "objectName": "测试车辆",
            "polygonID": "0",
            "speed": "0"
        },
        "state": 0
    },
    "dataType": "Alarm",
    "objectID": "123456"
}

"
  • 报警结束推送data内容字段:
字段 类型 必填 说明
alarmID Long true 报警编号
state string true 报警状态,0:报警开始, 1:报警结束
  • 报警结束请求示例:
curl http://url/api/active/push -X POST -d "
{
    "data": {
        "alarmID": "3830",
        "state": 1
    },
    "dataType": "Alarm",
    "objectID": "123456"
}
"
  • 位置变更推送data内容字段:
字段 类型 必填 说明
objectId int true 设备ID
objectName string true 设备名称
imei string true 设备imei
transType int true 在线状态:1-在线 0-离线
rcvTime string true 接受时间
gpsTime string true GPS定位时间
gpsLon float true GPS定位经度
gpsLat float true GPS定位纬度
bsTime string true 基站定位时间
bsLon float false 基站定位经度
bsLan float true 基站定位纬度
wifiTime string true WIFI定位时间
wifiLon float true WIFI定位经度
wifiLat float true WIFI定位纬度
posMode int true 当前定位方式(0-精准GPS定位 1-非精准GPS定位 2-基站定位 3-WIFI定位)
speed int true GPS速度(单位:km/h)
direct int true GPS方向(0-360°)
milgeage int true 总里程(单位:m)
dayMileage int true 当日行驶里程(单位:m)
isStopStateType int true 启动熄火状态(0-启动 1-熄火)
isStopStateDesc string true 启动熄火状态描述(启动/熄火)
bdTime string true 百度坐标系位置对应定位时间
bdLon float true 当前定位经度转换为百度坐标系的数值
bdLat float true 当前定位纬度转换为百度坐标系的数值
battery int true 电量 (0-100%)
gpsSignal int false GPS卫星颗数
bdSignal int false 北斗卫星颗数
gsmSingal int false GSM信号强度(1-5)
startTime string false isStopStateType=0时有效,表示启动时间(运动时长可以使用当前时间和此字段的差值计算),无效时请填写默认值:1970-01-01 08:00:00
stopTime string false isStopStateType=1时有效,表示熄火时间(静止时长可以使用当前时间和此字段的差值计算),无效时请填写默认值:1970-01-01 08:00:00
MDTTypeStatus int false 0:有线设备 1:无线设备
State int false 设备运营状态 : 0、1:正常; 2、3:未开通; 4、5:过期; 6:报停; 7、8:未使用。
DeviceState int false 0:库存,1:未使用,2:已安装, 3:拆机, 4:报修
  • 实时位置信息的请求示例:
curl http://url/api/active/push -X POST -d "
{
    "data": {
        "objectId": 10023456,
        "objectName":"张三的车",
        "imei": "233455566644",
        "transType": 1,
        "rcvTime": "2018-05-24 12:23:22",
        "gpsTime": "2018-05-24 12:23:21",
        "gpsLon": 113.364450,
        "gpsLat": 22.919983,
        "bsTime": "2018-05-24 12:23:22",
        "bsLon": 113.364450,
        "bsLat": 22.919983,
        "wifiTime": "2018-05-24 12:23:22",
        "wifiLon": 113.364450,
        "wifiLat": 22.919983,
        "posMode": 0,
        "speed": 2,
        "direct": 23,
        "milgeage": 1002324,
        "dayMileage": 3245,
        "isStopStateType": 1,
        "isStopStateDesc": "启动",
        "bdTime": "2018-05-24 12:23:22",
        "bdLon": 113.364450,
        "bdLat": 22.919983,
        "battery": 4,
        "gpsSignal": 12,
        "bdSignal": 0,
        "gsmSingal": 3,
        "startTime": "2018-08-29 12:23:12",
        "stopTime": "1970-01-01 08:00:00",
        "MDTTypeStatus": "2018-08-29 12:23:12",
        "State": "1970-01-01 08:00:00",
        "DeviceState ": "1970-01-01 08:00:00"
    },
    "dataType": "Location",
    "objectID": 123456
}
"