我是靠谱客的博主 瘦瘦钥匙,最近开发中收集的这篇文章主要介绍数位云开发者平台:室内定位api接入文档API文档1 概述2 接口说明3 签名算法4 后台 SDK5 业务码说明,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

API文档

1 概述

数位云场景识别 API v3接口用于查询用户的场景位置、标签等 POI数据,用户可以使用 Java、Golang、C#、 C++、Python 等开发语言发送请求且接收 JSON 格式数据。

1.1 接入流程

  1. 在数位云菜单“我的应用”创建一个应用后,即可查看到AppID和AppKey,与数位商务同事取得联系,激活AppID和AppKey;

  2. 使用AppID和AppKey接入API进行测试,提供单次和批量两种请求接口,接入步骤如下:

    1) 请求头:按格式设置请求头;

    2) 请求体:按请求参数字段和示例的格式设置请求体;

    3) 签名:按签名规则计算签名,并给签名参数 sign 字段赋值;

    4) 加密:按加解密规则对请求体加密;

    5) 发送请求:将请求头和加密后的请求体发送至接口地址即可获得加密后的响应;

    6) 解密:将加密后的响应按加解密规则解密即可获得明文场景识别结果;

    7) 接入成功标志:响应中 retCode 字段值为0或201001;

    8) 业务码:详细的retCode 说明可参考业务码说明;

    9) 同时也提供多种语言API接入SDK,可简化接入过程,详情参考SDK中的README.md。

  3. 成功接入API后,数位商务同事将提供场景开始测试;

  4. 测试通过后协商正式上线。

2 接口说明

2.1 场景识别单次请求接口

接口地址:https://api.jjfinder.com/v3/scene/api

通过POST方式提交数据到API需要使用测试AppID作为唯一标识,使用测试AppKey进行签名。

注意:请求接口的域名及AppID、AppKey请以商务邮件为准,正式上线时请使用生产的配置。

2.1.1接口参数说明

2.1.1.1设置请求头

在请求头中添加Authorization,值为场景识别单次请求接口 2.1.1.2 中参数内容拼接,格式如下:

t=%d;a=%s;

生成Authorization样例代码如下:

  public String authorization(){      
          return String.format("t=%d;a=%s;",timestamp, appId);  }  

添加请求头样例代码:

conn.setRequestProperty("Content-Type","application/json");
conn.setRequestProperty("Authorization",authorization);      

2.1.1.2 请求参数

定位请求必须参数:

序号字段数据 类型是 否签名含义
1timestampLong请求时间戳(ms)
2appIdStringappId,由数位分配
3oidString唯一标识 Android设备标识为IMEI号 iOS设备标识为IDFA
4oidTypeString唯一标识符类型(数位最终值为小写保存) 1:IMEI 4:iOS设备IDFA
5macStringmac地址/或者iOS IDFV
6macTypeString3:MAC地址(默认缺省,可以不传)
7networkModeString连网方式 0:unknown 1:WiFi 2:2G 3:3G 4:4G 5:5G
8ssidEncodeIntegerssid是否做base64加密(1加密0不加密)
9osTypeInteger操作系统类型: 0:未知 1:Android 手机 2:IOS 手机 3:Android TV 4:苹果TV 5:Android 手表 6:IOS 手表 7:Android 平板 8:IOS 平板 9:车载
10appChannelInteger流量来源的应用类型: 0:未知 1:app 2:微信小程序 3:支付宝小程序 4:百度小程序 5:头条小程序 6:快应用 7:设备操作系统集成 8:其他
11passthroughString透传字段
12signString签名
13signalsListWiFi信号列表
13.1bssidString信号bssid
13.2rssiInteger信号强度(dBm)
13.3ssidString信号名称
13.4connectStateInteger是否为连接信号(1连接,默认为null)
13.5timestampLong采集时间戳
13.6bandInteger频段(1:2.4G,2:5G)
13.7channelInteger信道

连接基站信息:每次定位

14baseStationListList基站信息列表,根据运营商情况填写具备的参数值
14.1typeInteger所属网络 0:未知, 1:GSM,2: CDMA,3:WCDMA ,4:LTE
14.2mccInteger移动国家代码 (GSM,CDMA,WCDMA,LTE)
14.3mncInteger移动网络号码 (GSM,CDMA,WCDMA,LTE)
14.4lacInteger位置区域码 (GSM,WCDMA)
14.5cidIntegerUMTS小区身份(GSM,WCDMA)
14.6tacInteger跟踪区域码 (LTE)
14.7ciInteger小区标识(LTE)
14.8pciInteger物理小区id (LTE)
14.9pscIntegerWCDMA主扰码(WCDMA)
14.10sidIntegerCDMA System ID (CDMA)
14.11nidIntegerNetwork ID (CDMA)
14.12bidIntegerBase Station ID (CDMA)
14.13dBmInteger1毫瓦分贝数 (GSM,CDMA,WCDMA,LTE)
14.14asuLevelIntegerAsu信号单元 (GSM,CDMA,WCDMA,LTE)
14.15levelInteger信号格(GSM,CDMA,WCDMA,LTE)
14.16timestampLong采集时间戳
14.17registerInteger是否已注册
14.18baseStationTypeString基站实例类型
14.19earfcnIntegerAndroid N 新增,绝对射频频道号(LTE)
14.20bandWidthInteger小区带宽(LTE)
14.21arfcnIntegerAndroid N 新增,绝对射频频道号(GSM)
14.22bsicIntegerAndroid N 新增,基站识别码,物理小区id(GSM)
14.23uarfcnIntegerAndroid N 新增,绝对射频频道号(WCDMA)
14.24rsrpInteger信号接收强度(LTE)
14.25rsrqInteger信号接收质量(LTE)
14.26rssnrInteger信噪比(LTE)
14.27cqiInteger信道质量指标(LTE)
14.28timingAdvanceInteger时间提前量(GSM,LTE)
14.29csiRsrpIntegercsi信号接收强度(NR)
14.30csiRsrqIntegercsi信号接收质量(NR)
14.31csiSinrIntegercsi信噪比(NR)
14.32ssRsrpIntegerss信号接收强度(NR)
14.33ssRsrqIntegerss信号接收质量(NR)
14.34ssSinrIntegerss信噪比(NR)
14.35nciLong小区标识(NR)
14.36nrarfcnInteger绝对射频频道号(NR)
14.37bitErrorRateInteger误码率(GSM,WCDMA)
14.38mCdmaDbmInteger电信2G Dbm
14.39mCdmaEcioInteger电信2G Ec/Io)
14.40mEvdoDbmInteger电信3G Dbm
14.41mEvdoEcioInteger电信3G Ec/Io
14.42mEvdoSnrInteger电信3G 信噪比

设备信息发送周期:每月首次

15deviceInfoMap设备信息
15.1imeiStringAndroid 系统的设备号
15.2idfaString仅iOS 6.0以上系统的IDFA,如 4CFD11F0-09D0-4BF3-91CE-D50600BD0E64
15.3andidString用户终端的Android ID,如 9774d56d682e549c
15.4deviceString设备品牌和型号,如honor v8、Sumsang S6
15.5osvString操作系统版本,如 iPhone 8.1.2 的参数填写 8.1.2
15.6carrierString运营商 0:unknown 1:CMCC 2:CUCC 3:CTCC
15.7imsiString国际移动用户识别码,如 460030912121001
15.8romInfoStringRom信息, 如:Meizu/FLYME/Flyme+6.2.0.2A
15.9widthFloat屏幕宽度
15.10heightFloat屏幕高度

应用列表发送周期:每星期首次

16appInfoList手机安装app信息
16.1applicationIdString应用的 PackageName
16.2versionCodeInteger版本号
16.3versionNameString版本号
16.4firstTimeLong首次安装时间ms
16.5lastTimeLong最新更新时间ms
16.6totalTimeLongApp前台使用时长

蓝牙列表发送周期:每次定位

17bluetoothInfoList周边蓝牙设备信息
17.1nameString设备名称
17.2macStringMAC地址,去除冒号分隔符保持小写
17.3rssiInteger信号强度(dBm)
17.4ibeaconUUIDString设备UUID
17.5ibeaconMajorIdInteger设备MajorId
17.6ibeaconMinorIdInteger设备MinorId
17.7timestampLong采集时间戳

磁场信息发送周期:每次定位

18magneticInfoMap移动设备所在位置的磁场信息
18.1magXDoubleX轴方向的磁感应强度
18.2magYDoubleY轴方向的磁感应强度
18.3magZDoubleZ轴方向的磁感应强度
18.4timestampLong采集时间戳
18.5sensorNameString传感器名称
18.6sensorVendorString传感器供应商
18.7sensorVersionString传感器版本

姿态方向信息发送周期:每次定位

19orientationInfoMap移动设备的姿态方向信息
19.1pitchDouble俯仰角,绕X轴产生的角
19.2rollDouble翻转角,绕Y轴产生的角
19.3azimuthDouble方向角,绕Z轴产生的角
19.4timestampLong采集时间戳
19.5sensorNameString传感器名称
19.6sensorVendorString传感器供应商
19.7sensorVersionString传感器版本

光强信息发送周期:每次定位

20lightInfoMap移动设备获取到的光强信息
20.1luxDouble光强
20.2timestampLong采集时间戳
20.3sensorNameString传感器名称
20.4sensorVendorString传感器供应商
20.5sensorVersionString传感器版本

GPS信息发送周期:每次定位

21gpsInfoMapGPS定位相关信息
21.1satelliteInfoList卫星信息
21.1.1mHasEphemerisBooleanGPS引擎是否有卫星星历(有则返回true)
21.1.2mHasAlmanacBooleanGPS引擎是否有近似轨道信息(有则返回true)
21.1.3mUsedInFixBoolean卫星是否被GPS引擎用于计算最近位置(是则返回true)
21.1.4mPrnInteger伪随机噪声码,是一个具有一定周期的取值0和1的离散符号串,它具有类似于白噪声的自相关函数
21.1.5mSnrDouble卫星的信噪比 (单位:db)
21.1.6mElevationDouble卫星的高度角,范围0-90度
21.1.7mAzimuthDouble卫星的方位角,范围0-360度
21.1.8mCarrierFrequencyHzDouble所跟踪信号的载波频率
21.2mProviderString获取是网络定位、GPS定位还是被动定位
21.3mHorizontalAccuracyMetersDouble获取此位置的估计精确度 (单位:m)
21.4mAltitudeDouble海拔高度,以WGS 84模型作为参考
21.5mBearingDouble方向度数(0,360)表示正北偏东多少度(0->北,90->东,180->南,270->西)
21.6mElapsedRealtimeNanosLong从移动终端启动的时候起经过的时间 (单位:ns)
21.7mSpeedDouble自传速度(单位:m/s)
21.8mSatelliteCountInteger扫描到的卫星总数
21.9timestampLong采集时间戳

经纬度坐标信息:每次定位

22coordinateInfoMap经纬度坐标信息
22.1coordinateSystemString坐标系 BD09:百度坐标系 GCJ02:高德、火星坐标系 WGS84:谷歌地球坐标系
22.2longitudeDoubleGPS经度
22.3latitudeDoubleGPS纬度
22.4timestampLong采集时间戳

请求参数示例:测试前请替换appId及签名信息sign

{
    "timestamp": 1490839495229,
    "appId": "38f6a65f4df2",
    "oid": "52D846AC-63A6-4362-BAC8-DB0EC3B0F82B",
    "oidType": "4",
    "mac": "80FC7C2C-A17D-4537-9BFA-9184D07D0431",
    "networkMode": "3",
    "passthrough": "passthrough_example",
    "sign": "b1d149458113278a3e61287ce1896644abe00189",
    "signals": [{
        "bssid": "e4aa5d3e7d10",
        "rssi": -55,
        "ssid": "Coastal City Free",
        "connectState": 1,
        "timestamp": 1490839495229
    }, {
        "bssid": "e4aa5d3e7d11",
        "rssi": -55,
        "ssid": "LCD_WiFi",
        "timestamp": 1490839495229
    }, {
        "bssid": "8682f42adad5",
        "rssi": -57,
        "ssid": "Superdry2",
        "timestamp": 1490839495229
    }, {
        "bssid": "8482f42adad5",
        "rssi": -57,
        "ssid": "Superdry",
        "timestamp": 1490839495229
    }],
    "baseStationList": [{
        "type": 4,
        "mcc": 460,
        "mnc": 11,
        "lac": null,
        "cid": null,
        "tac": 6165,
        "ci": 26366002,
        "pci": 189,
        "psc": null,
        "sid": null,
        "nid": null,
        "bid": null,
        "dBm": -93,
        "asuLevel": 4,
        "level": 4,
        "timestamp": 1490839495229,
        "register": 1
    }],
"coordinateInfo": {
        "coordinateSystem": "GCJ02",
        "longitude": 113.9359091493863,
        "latitude": 22.5269166908687,
        "timestamp": 1490839495229
    },
    "deviceInfo": {
        "imei": "861839038135744",
        "idfa": "",
        "andid": "bf49728053e511bf",
        "device": "honor v8",
        "osv": "6.0",
        "carrier": "2",
        "imsi": "460030912121001",
        "romInfo": "Meizu/FLYME/Flyme+6.2.0.2A",
        "width": 540,
        "height": 960
    },
    "appInfo": [{
        "applicationId": "com.example.app",
        "versionCode": 2,
        "versionName": "1.1",
        "firstTime": 1487045308000,
        "lastTime": 1487045308000,
        "totalTime": 1487045308000
    }],
    "bluetoothInfo": [{
            "name": "",
            "mac": "64a651e5ff4f",
            "rssi": -26,
            "ibeaconUUID": "00000000-0000-0000-0000-000000000000",
            "ibeaconMajorId": 100,
            "ibeaconMinorId": 1,
            "timestamp": 1490839495229
        },
        {
            "name": "",
            "mac": "64a651e5ff4f",
            "rssi": -52,
            "ibeaconUUID": "00000000-0000-0000-0000-000000000000",
            "ibeaconMajorId": 100,
            "ibeaconMinorId": 1,
            "timestamp": 1490839495229
        }
    ],
    "magneticInfo": {
        "magX": 41.4567754607595,
        "magY": 34.7876059543584,
        "magZ": 30.1879635400726,
        "sensorName": "MMC3416PJ Magnetometer",
        "sensorVendor": "MEMSIC",
        "sensorVersion": "1",
        "timestamp": 1490839495229
    },
    "orientationInfo": {
        "pitch": 10,
        "roll": -30,
        "azimuth": 180,
        "sensorName": "Orientation",
        "sensorVendor": "QTI",
        "sensorVersion": "2",
        "timestamp": 1490839495229
    },
    "lightInfo": {
        "lux": 115,
        "sensorName": "APDS-9921 Light",
        "sensorVendor": "Avago",
        "sensorVersion": "1",
        "timestamp": 1490839495229
    },
    "gpsInfo": {
        "satelliteInfo": [{
            "mHasEphemeris": false,
            "mHasAlmanac": true,
            "mUsedInFix": false,
            "mPrn": 13,
            "mSnr": 0.0,
            "mElevation": 49.0,
            "mAzimuth": 299.0
        }],
        "mProvider": "gps",
        "mHorizontalAccuracyMeters": 56.70,
        "mAltitude": 0.0,
        "mBearing": 77,
        "mElapsedRealtimeNanos": 123456789,
        "mSpeed": 0.0,
        "mSatelliteCount": 1,
        "timestamp": 1490839495229
    },
    "ssidEncode": 0,
    "osType": 1,
    "appChannel": 1
}

2.1.1.3 响应参数

序号字段数据类型说 明
1retCodeInteger业务码。0:定位成功,包含结果; >0:参见业务码说明。
2msgString业务码辅助提示信息。 有定位结果:"OK"; 无定位结果或其他:参见业务码说明。
3requestSignString请求签名
4data 返回数据实体
4.1timestampString接口响应时间戳(ms)
4.2cityString城市
4.3regionString行政区
4.4areaString商圈信息
4.5addressString地址
4.6floorNameString楼层信息
4.7nameStringPOI名称
4.8brandString品牌
4.9areaCategoryString商圈分类
4.10areaAttributeString商圈属性
4.11poiIdStringPOI唯一标识
4.12poiCategoryStringPOI分类
4.13poiAttributeStringPOI属性
4.14coordinateSystemString经纬度坐标系类型: BD09-百度坐标系; GCJ02-火星坐标系; WGS84-地球坐标系
4.15longitudeDouble经度
4.16latitudeDouble纬度
4.17passthroughString透传参数

响应参数示例:

{
    "retCode": 0,
    "msg": "OK",
    "requestSign": "439d8190a0ac977306ae436859bd4a9b25a64ada",
    "data": {
        "timestamp": 1552374907740,
        "city": "深圳市",
        "region": "南山区",
        "area": "海岸城购物中心",
        "address": "文心四路14",
        "floorName": "1",
        "name": "zara",
        "brand": "zara",
        "areaCategory": "购物中心;商场",
        "areaAttribute": "档次:高档",
        "poiId": "fdae3e2cd316bb8a",
        "poiCategory": "购物;服装",
        "poiAttribute": "风格:潮流时尚|品牌来源:欧美",
        "coordinateSystem": "GCJ02",
        "longitude": 113.936074,
        "latitude": 22.51703,
        "passthrough": "passthrough_example"
    }
}

2.2 场景识别批量请求接口

接口地址:https://api.jjfinder.com/v3/scene/api/batch

通过POST方式提交数据到API需要使用测试AppID作为唯一标识,使用测试AppKey进行签名。

注意:请求接口的域名及AppID、AppKey请以商务邮件为准,正式上线时请使用生产的配置。

2.2.1接口参数说明

2.2.1.1设置请求头

在请求头中添加Authorization,值为 2.2.1.2 中参数内容以及请求List长度拼接,List长度值允许范围是:[1, 10],格式如下:

t=%d;a=%s;bs=%d;

生成Authorization样例代码如下:

public String authorization(){      
    return String.format("t=%d;a=%s;bs=%d;",timestamp, appId, requestListSize);  }  

添加请求头样例代码:

conn.setRequestProperty("Content-Type","application/json");

conn.setRequestProperty("Authorization",authorization);    

2.2.1.2 请求参数

定位请求必须参数:只需把 2.1.1.2 对象改为List ,List最多允许放10条数据

请求参数示例:测试前请替换appId及签名信息sign

[
{
    "timestamp": 1490839495229,
    "appId": "38f6a65f4df2",
    "oid": "52D846AC-63A6-4362-BAC8-DB0EC3B0F82B",
    "oidType": "4",
    "mac": "80FC7C2C-A17D-4537-9BFA-9184D07D0431",
    "networkMode": "3",
    "passthrough": "passthrough_example",
    "sign": "b1d149458113278a3e61287ce1896644abe00189",
    "signals": [{
        "bssid": "e4aa5d3e7d10",
        "rssi": -55,
        "ssid": "Coastal City Free",
        "connectState": 1,
        "timestamp": 1490839495229
    }, {
        "bssid": "e4aa5d3e7d11",
        "rssi": -55,
        "ssid": "LCD_WiFi",
        "timestamp": 1490839495229
    }, {
        "bssid": "8682f42adad5",
        "rssi": -57,
        "ssid": "Superdry2",
        "timestamp": 1490839495229
    }, {
        "bssid": "8482f42adad5",
        "rssi": -57,
        "ssid": "Superdry",
        "timestamp": 1490839495229
    }],
    "baseStationList": [{
        "type": 4,
        "mcc": 460,
        "mnc": 11,
        "lac": null,
        "cid": null,
        "tac": 6165,
        "ci": 26366002,
        "pci": 189,
        "psc": null,
        "sid": null,
        "nid": null,
        "bid": null,
        "dBm": -93,
        "asuLevel": 4,
        "level": 4,
        "timestamp": 1490839495229,
        "register": 1
    }],
"coordinateInfo": {
        "coordinateSystem": "GCJ02",
        "longitude": 113.9359091493863,
        "latitude": 22.5269166908687,
        "timestamp": 1490839495229
    },
    "deviceInfo": {
        "imei": "861839038135744",
        "idfa": "",
        "andid": "bf49728053e511bf",
        "device": "honor v8",
        "osv": "6.0",
        "carrier": "2",
        "imsi": "460030912121001",
        "romInfo": "Meizu/FLYME/Flyme+6.2.0.2A",
        "width": 540,
        "height": 960
    },
    "appInfo": [{
        "applicationId": "com.example.app",
        "versionCode": 2,
        "versionName": "1.1",
        "firstTime": 1487045308000,
        "lastTime": 1487045308000,
        "totalTime": 1487045308000
    }],
    "bluetoothInfo": [{
            "name": "",
            "mac": "64a651e5ff4f",
            "rssi": -26,
            "ibeaconUUID": "00000000-0000-0000-0000-000000000000",
            "ibeaconMajorId": 100,
            "ibeaconMinorId": 1,
            "timestamp": 1490839495229
        },
        {
            "name": "",
            "mac": "64a651e5ff4f",
            "rssi": -52,
            "ibeaconUUID": "00000000-0000-0000-0000-000000000000",
            "ibeaconMajorId": 100,
            "ibeaconMinorId": 1,
            "timestamp": 1490839495229
        }
    ],
    "magneticInfo": {
        "magX": 41.4567754607595,
        "magY": 34.7876059543584,
        "magZ": 30.1879635400726,
        "sensorName": "MMC3416PJ Magnetometer",
        "sensorVendor": "MEMSIC",
        "sensorVersion": "1",
        "timestamp": 1490839495229
    },
    "orientationInfo": {
        "pitch": 10,
        "roll": -30,
        "azimuth": 180,
        "sensorName": "Orientation",
        "sensorVendor": "QTI",
        "sensorVersion": "2",
        "timestamp": 1490839495229
    },
    "lightInfo": {
        "lux": 115,
        "sensorName": "APDS-9921 Light",
        "sensorVendor": "Avago",
        "sensorVersion": "1",
        "timestamp": 1490839495229
    },
    "gpsInfo": {
        "satelliteInfo": [{
            "mHasEphemeris": false,
            "mHasAlmanac": true,
            "mUsedInFix": false,
            "mPrn": 13,
            "mSnr": 0.0,
            "mElevation": 49.0,
            "mAzimuth": 299.0
        }],
        "mProvider": "gps",
        "mHorizontalAccuracyMeters": 56.70,
        "mAltitude": 0.0,
        "mBearing": 77,
        "mElapsedRealtimeNanos": 123456789,
        "mSpeed": 0.0,
        "mSatelliteCount": 1,
        "timestamp": 1490839495229
    },
    "ssidEncode": 0,
    "osType": 1,
    "appChannel": 1
}
]

2.2.1.3 响应参数

响应参数说明:即 2.1.1.3 的响应参数的List形式,可以通过requestSign与请求进行关联

响应参数示例:

[
{
    "retCode": 0,
    "msg": "OK",
    "requestSign": "439d8190a0ac977306ae436859bd4a9b25a64ada",
    "data": {
        "timestamp":1552374907740,
        "city": "深圳市",
        "region": "南山区",
        "area": "海岸城购物中心",
        "address": "文心四路14",
        "floorName": "1",
        "name": "zara",
        "brand": "zara",
        "areaCategory": "购物中心;商场",
        "areaAttribute": "档次:高档",
        "poiId": "fdae3e2cd316bb8a",
        "poiCategory": "购物;服装",
        "poiAttribute": "风格:潮流时尚|品牌来源:欧美",
        "coordinateSystem": "GCJ02",
        "longitude": 113.936074,
        "latitude": 22.51703,
        "passthrough": "passthrough_example"
    }
}
]

2.3 请求和响应数据需要AES加解密

2.3.1 加解密方式

加解密密钥:appkey去除"-"后取前16位;

加密算法:AES128;

AES模式:CBC;

AES填充方式:PKCS#7;

AES向量:appkey去除"-"后取后16位;

字符集:UTF-8;

编码:Base64编码。

2.3.2 加解密示例

A、AppKey: 5d4a7bac-98a2-4a9f-a47a-38f6a65f4df2

​ 密钥:5d4a7bac98a24a9f

​ 向量:a47a38f6a65f4df2

B、对上面 2.1.1.2 中的单接口请求参数示例数据加密示例如下:

nW2De+qq6ENDARqLN0QvCKgnJHR7IDK+k3oWTUba8UKsSGX58bFDmU8xkgbI2YiA6p5ZbpiSKHc234U1m/E2FXCcATtRiKhs3AmQ4spQF+zCKhCyV/dSKkCAufi2xYt8qxfjR/kGn+Qi7+gEotSkXy50iQpX4BTbmWXHK1KnP3RyZ2GAuNn+L6WhsjXw8sTVILB3oNJ5qUXPHMRiEmpqlqUb3R8ZCMEHifB5ydMpbeIhkwZ8AjWqgwWm7IxSWo0XYZaHypIyMyw/mLT7DLvIddxdD3axN5fvkFAjnWV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euYxOt+Urh824o25vQUpluaSPMDLRnQke+Io5DhH84kwnz7bBfjIrahqYza1Dh8FF6wrH/4d05AaTAVjXYb51cxYj7TLPbmcGtlgJ64Pi9pQ97lt7mrNtxkgbSqFCNEYVdi4zs7C9EAn0radPjD3rOIUk5WzCS1+1v7sLn51WsueMl9PQBeN6UiA5yMxwjuNQOBAAYoVODJRy+rTr+1rkehH65w4katzv1FC0Deugnnsy9apMOvyFmceXhUrJDWSd+nYSQs76K5WAMX7/xXWB51R+QlPHOKLcJFEt5qzTlcl2BJO261ojLz3DWXTlCr9OvEmDCTIF8sR8nM4XbdIrdip2CRqmUZ21+YUNUq/AxAHbDAwyHXbijdgUf7hD8Gl1b0VTxxrt+Tiowr2bQY8UbKNj/Jep3UPFQnQ6IOn90GhphCrfJX/f4sUV7l9bXqGjDRynmsyU+BefwNkmeTCz86VmalnkAQ/Ds4tfhIItj8VfHtSJ/jUAF5khKZgW8YcjAchLc3+VlzYOHKJLh7WbqtRigvIbg==

C、对上面 2.2.1.2 中的批量接口请求参数示例数据加密示例如下:

tM7bMc7JJqUOjdQTEltpS5FG0DeVJijh4z8/ORP/1aMOxL3OsQeu4ORuvp38cecsc0mSsHmi3hqGtjzBBQSv/1zHCWanQG+4U68whYuu/vFeWv8SXchX7XIYOOHPpD9B0RU1TBPniAEqSqtd3xjeg5Ruz4hZMWf167nLQ6g+5POPurOCRGmS3X4LtrrOZZpyQRJfY6qsKLiYKkhgbv2nLGcT8I2VDDgueHnvTP5+y6SJaNlmGynlc1Ihiiac01aw4JiXESL8/IIvNnTS94/h44Gn3n0ZAWu66OOprV926ZjNU5Bokdak4R0T8i3kmFNuZe/0TqvYqzv7Is28WSBmp6i52M33FbjW1b7nrxbNIkTS83o5j931a4sEPgEiz0EYTwgCn2+6ZnZfspwA2D0/KoQp7M7y8RGsuPtG2sqHD1eHSgo13XZpuuo+RedWxbRj1q1xBpAkBWUShuS8AZkHrusk1yeU6gHwLOPIHQnryto0V9/yFPeIcw03v9g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kD9vnZikjFHJ8O0n3zruHLNMszBDJwNPCDQoPWS0SY7iKcwCbzrDfVmyur6JFWDqAa0dF/WP7WGpdPzrSTzzpgd0bo05+lfVkjI9IjabYQH5ArSaBbj8czNDaMp99HlolHFIDLCmpCDw4HhyOimJEqkOKtWMYPNbk+sfr64nvcZsy4xPbavRLrGSr3rzFT5x7z1X4gyRdAWTwuqi3aC+6JnhdP8Tsa/ij38ix0bl/XCVHrjEsLsiAObBrtjV8c7I6hv+kd1PtQXhBQedHw19Ss0azpYUBG0UIgniWIrOxZghx9Lnzde5TLR4T1UkQ1Nda8OdmMs

3 签名算法

3.1 签名算法说明

1) 字符集为 utf-8;

2) 所有不为空的参数都需要加入签名,参数必须为做 urlencode 之前的原始数值。如中文 :"位置",作为参数传输时编码为%E9%87%91%E5%B8%81,做签名时则要用其原始中文值"位置"(注意字符集必须是 UTF-8);

3) 对所有不为空的参数按照参数名字母升序排列(如php的ksort函数);

4) 使用符号 # 拼装排序后的参数值, 最后用 # 连接应用的appKey, 整体用sha1计算签名, 就是 sign参数的值. 注意有些语言的计算结果里字母为大写, 需要转化为小写。

5) 批量接口List里面的每一条数据单独计算签名。

3.2 签名示例

对上面 2.1.1.2 请求参数示例数据签名示例如下:

A 参数名按照升序排序并把appKey的值拼接到最后,参数名拼接示例如下:

appChannel#appId#mac#networkMode#oid#oidType#osType#ssidEncode#timestamp#appKey

B 参数值拼接成签名串结果如下:

1#38f6a65f4df2#80FC7C2C-A17D-4537-9BFA-9184D07D0431#3#52D846AC-63A6-4362-BAC8-DB0EC3B0F82B#4#1#0#1490839495229#5d4a7bac-98a2-4a9f-a47a-38f6a65f4df2

C 对签名串做sha1加密后转小写即可得出sign结果如下:

b1d149458113278a3e61287ce1896644abe00189

4 后台 SDK

数位提供了Java、Golang两个版本的后台SDK,已在github开源,对上述请求头设置、加密、签名、请求及响应过程进行了封装,如果后台是这两种语言开发的,可以直接集成SDK包,以简化接入过程。

​ Java SDK:https://github.com/sw-cloud/shuwei-elbs-sdk-java

​ Golang SDK:https://github.com/sw-cloud/shuwei-elbs-sdk-go

5 业务码说明

retCodemsgremark
0OK定位有结果
100001System error服务器错误
100002Environment error环境错误
100003Miss required parameter缺少必传参数
100004Parameter value invalid参数格式错误
100005Sign error签名错误
100006Package name error包名错误
100007Request data is null请求数据为空
100008Lack authorization限制访问。缺少头部授权信息
100009Restricted access.App TPS reach limit限制访问。应用每秒事务数达到上限
100010Restricted access.Transaction reach limit限制访问。达到事务数配额上限
100011Restricted access.TPS reach limit限制访问。接口每秒事务数达到上限
100012Api version is wrong接口版本错误
10002001Illegal oid.Fake oid疑似虚假设备号
10002002Illegal oid.Oid request frequency is too high高频请求
201001No result定位无结果
203004AppId invalidAppId无效
203005App is disabledApp不可用
203006App type errorApp类型错误

最后

以上就是瘦瘦钥匙为你收集整理的数位云开发者平台:室内定位api接入文档API文档1 概述2 接口说明3 签名算法4 后台 SDK5 业务码说明的全部内容,希望文章能够帮你解决数位云开发者平台:室内定位api接入文档API文档1 概述2 接口说明3 签名算法4 后台 SDK5 业务码说明所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(49)

评论列表共有 0 条评论

立即
投稿
返回
顶部