Get device information from html5 page


New group

1475889489342022.png

##Interface Description

#Create a new device group. There are only a maximum of 1000 groups under each account.

Interface calling instructions

http request method: POST (please use https protocol) https:/ /api.weixin.qq.com/shakearound/device/group/add?access_token=ACCESS_TOKENPOST data format: jsonPOST data example:
{
"group_name":"test"
}

Parameter Description

ParameterIs it requiredDescription
access_token is the calling interface credential
group_nameisGroup name, no more than 100 Chinese characters or 200 English letters


Return description

Example of normal returned JSON data packet:

{
"data": {
"group_id" : 123,
"group_name" : "test"
},
"errcode": 0 ,
"errmsg": "success."
}

Parameter Description

参数说明
group_id 分组唯一标识,全局唯一
group_name分组名 

Edit group information

##Interface description

Edit device group information, currently only the group name can be modified.

Interface calling instructions

http request method: POST (please use https protocol) https:/ /api.weixin.qq.com/shakearound/device/group/update?access_token=ACCESS_TOKENPOST data format: jsonPOST data example:
{
"group_id":123,
"group_name" :"test update"
}

Parameter Description

ParameterIs it requiredDescription
access_token is the calling interface credential
group_idisGroup unique identifier, globally unique
group_nameis Group name, no more than 100 Chinese characters or 200 English letters


Return description

Example of normal returned JSON data packet:

{
"data": {
},
"errcode": 0,
"errmsg": "success."
}


#Delete group

Interface Description

Delete the device group. If there are still devices in the group, then Unable to delete successfully. The device needs to be removed before it can be deleted.

Interface calling instructions

http request method: POST (please use https protocol) https:/ /api.weixin.qq.com/shakearound/device/group/delete?access_token=ACCESS_TOKENPOST data format: json
POST data example:
{
"group_id":123
}

Parameter Description

ParameterIs it requiredDescription
access_token is the calling interface credential
group_idisGroup unique identifier, globally unique


Return description

Example of normal returned JSON data packet:

{
"data": {
},
"errcode": 0,
"errmsg": "success."
}


#Query grouping list

Interface Description

Query all groups under the account.

Interface calling instructions

http request method: POST (please use https protocol) https:/ /api.weixin.qq.com/shakearound/device/group/getlist? access_token=ACCESS_TOKEN
POST data format: json
POST data example:
{
"begin": 0,
"count" 10
}

Parameter Description

ParameterIs it requiredDescription
access_token is the calling interface credential
beginisThe starting index value of the grouping list
count is The number of groups to be queried cannot exceed 1000


Return description

Example of normal returned JSON data packet:

{
"data": {
"total_count": 100,
"groups":[
"{
"group_id" : 123,
"group_name" : "test1"
},
"group_id" : 124,
"group_name" : "test2"
}
]
},
"errcode": 0,
"errmsg": "success."
}

Parameter Description

total_count
Parameter Description
isThe total number of existing groups under this account##groups
is group list
group_id is the unique identifier of the group and is globally unique
group_name is group name

Query group details

# #Interface description

Query group details, including group name, group id, and device list in the group.

Interface calling instructions

http request method: POST (please use https protocol) https:/ /api.weixin.qq.com/shakearound/device/group/getdetail?access_token=ACCESS_TOKENPOST data format: jsonPOST data example:
{
"group_id":123
"begin": 0,
"count":100
}

Parameter Description

ParameterIs it requiredDescription
access_token is the calling interface credential
group_idisGroup unique identifier, globally unique
begin is The starting index value of the device in the group
countisThe number of devices in the group to be queried cannot exceed 1,000


Return description

Example of normal returned JSON data packet:

{
"data": {
"group_id" : 123,
"group_name" : "test",
"total_count": 100,
"devices" :[
                                                                                                                                                                                                      "devices_id" ,
" minor" : 10001,
"comment" : "test device1",
"poi_id" : 12345,
},
"device_id" : 123457,
"uuid" : "FDA50693-A4E2-4FB1-AFCF-C6EB07647825",
"major" : 10001,
"minor" : 10002,
"comment" : "test device2",
"poi_ id" : 12345,
            }
                              
                                                                                                                                         #

Parameter Description

Add device to group

Interface description

Add devices to a group. The upper limit of the devices that each group can hold is 10,000, and the upper limit of each addition operation is 1,000. Only devices that have been applied for by Shake Peripheral can be added to the group.

Interface calling instructions

http request method: POST (please use https protocol) https:/ /api.weixin.qq.com/shakearound/device/group/adddevice?access_token=ACCESS_TOKENPOST Data format: json
POST data example:
{
"group_id": 123,
"device_identifiers" ; "minor": 10002
        }
        ]
}


Parameter Description

ParameterDescription
group_idGroup unique identifier, globally unique
group_nameGroup name
total_countThe total number of existing devices in this group
devicesDevice list under group
device_idDevice number, device global unique ID
##uuid, major, minor uuid, major, minor
commentComment information of the device
poi_idThe store ID associated with the device. After the store is associated, there will be an opportunity to give priority to information within 1KM of the store. . For specific store-related information, you canView the store-related interface documents

## is UUID, major, minor. Three pieces of information need to be filled in. If you fill in the device number, you don’t need to fill in this. Information, choose one of the twogroup_id isGroup unique identifier, globally unique

Return instructions

Example of normal returned JSON data packet:

{
"data": {
},
"errcode": 0,
"errmsg": "success."
}


##Remove device from group

Interface description

Remove the device from the group, each deletion operation The upper limit is 1000.

Interface calling instructions

http request method: POST (please use https protocol) https:/ /api.weixin.qq.com/shakearound/device/group/deletedevice?access_token=ACCESS_TOKENPOST Data format: json
POST data example:
{
"group_id": 123,
"device_identifiers" ; "minor": 10002
        }
        ]
}



Parameter Description

ParameterIs it requiredDescription
access_token is the calling interface credential
device_identifiersisDevice id list
device_idis Device number, if you fill in UUID, major, minor, you don’t need to fill in the device number, choose one of the two
##UUID, major , minor
## is UUID, major, minor. Three pieces of information need to be filled in. If you fill in the device number, you don’t need to fill in this. Information, choose one of the twogroup_id isGroup unique identifier, globally unique


Return description

Example of normal returned JSON data packet:

{
"data": {
},
"errcode": 0,
"errmsg": "success."
}


##H5 page gets device information JS API

Directory

1 Open search for surroundings ibeacon device interface

2 Close the search for surrounding ibeacon device interface

3 Monitor the surrounding ibeacon device interface

Interface Description

The JS API for obtaining device information from the H5 page is to expand the scenarios of peripheral applications and allow developers to use the interface in their H5 applications. Enter WeChat JS-SDK to implement a set of APIs for searching surrounding Beacon signals. Before calling this interface, you need to group the devices first. The WeChat client will only return the device information that is already in the group. How to group the devices, please check the interface description related to the above grouping.

H5 page to obtain device information JSAPI includes three interfaces: startSearchBeacons, stopSearchBeacons, and onSearchBeacons. It only supports WeChat version 6.2.5 or above. It needs to be called using WeChat JS-SDK, and the public account called must be grouped with the creation The public account is consistent. Introduce the following JS file on the page that needs to call the JS interface (supports https): http://res.wx.qq.com/open/js/jweixin-1.1.0.js, View the specific JS-SDK call method.

Enable the interface to search for surrounding ibeacon devices

Interface description

Search for peripheral devices. The purpose is to provide merchants with certain development capabilities with an interface to find their own peripheral devices. The web pages accessed in WeChat’s built-in browser can be called using this JS code. It can search for the merchant's own peripheral equipment, so that merchants can use this interface to check whether their own equipment exists nearby. The WeChat client will return device information as long as it detects a device with signal, and the time interval is 1S. Both Android and iOS will return devices with information detected in batches.

Interface calling instructions

Example:
wx.startSearchBeacons({
ticket:"",
complete:function(argv){
//Callback function
}
});

Parameter Description

ParameterIs it requiredDescription
access_token is the calling interface credential
device_identifiersisDevice id list
device_idis Device number, if you fill in UUID, major, minor, you don’t need to fill in the device number, choose one of the two
##UUID, major , minor
ParameterIs it requiredDescription
ticketNo Shake the surrounding business tickets, and the system will automatically add them to the shaken ones Behind the page link
#

Return instructions

Open successfully and return: "startSearchBeacons:ok";

After opening Not stopped and turned on again: "startSearchBeacons: already started";

Bluetooth is not turned on. Return: "startSearchBeacons: bluetooth power off";

Geography The location service is not turned on and returns: "startSearchBeacons:location service disable";

The system does not support it. Returns: "startSearchBeacons:system unsupported".

Close the interface for searching for surrounding ibeacon devices

Interface description

Close the search for peripheral devices.

Interface calling instructions

Example:
wx.stopSearchBeacons({
complete :function(res){
//Callback function
}
});

Return instructions

Close successfully and return "stopSearchBeacons:ok";

Monitoring peripheral ibeacon device interface

Interface description

##Monitoring peripheral device onSearchBeacons The interface is called back after the startSearchBeacons interface is opened. This interface returns related peripheral devices registered by the merchant.

Interface calling instructions

Example: wx.onSearchBeacons({
complete :function(argv){
//Callback function
}
});

返回说明

onSearchBeacons:
{
  "beacons":[
          {
          "major":10008,
          "minor":57686,
          "uuid":"FDA50693-A4E2-4FB1-AFCF-C6EB07647825",
          "accuracy":"0.235344",
          "rssi":"-66",
          "proximity":"1",
          "heading":"288.1355"
          },
          {
          "major":10008,
          "minor":57687,
          "uuid":"FDA50693-A4E2-4FB1-AFCF-C6EB07647825",
          "accuracy":"0.349124",
          "rssi":"-49",
          "proximity":"2",
          "heading":"288.1355"
          }
          ]
}

Parameter Description

##proximityAccuracy, 0: CLProximityUnknown, 1: CLProximityImmediate, 2: CLProximityNear, 3:CLProximityFar
ParametersDescription
UUID, major , minorUUID, major, minor
##accuracy Distance, unit is meters
rssiReceived signal strength indication
headingThe direction of the device when receiving the signal (Android devices return this field, iOS does not); if iOS devices need to obtain the direction, they can use the HTML5 standard API to obtain it, View example



##