README
Using a webhook, push notifications will be made when data is reported on the device.
Select the service that needs to be activated for push, fill in the URL address
When the device reports data, it will integrate the reported data into a parameter called "data".
Different push situations result in different data objects contained in "data"
AlarmData
Field | Type | Required | Note |
---|---|---|---|
actual | boolean | true | Real time or supplementary transmission |
deviceId | string | true | Device ID |
reportCt | number | true | Device Data reporting time (Device Time Zone) |
deviceCt | number | true | Gateway Data reporting time (UTC +0) |
alarmType | string | true | Alarm types ‘,’ multiple separated by commas |
alarmId | string | true | Unique alarmId,matches the “alarmFilePage” alarmId field “alarmHistoryPage” id field |
id | string | true | Unique ID, if it matches the ID in GPS, it indicates that the information attached to this GPS package |
lat | number | true | |
lon | number | true |
"data":
{
"actual":true,
"deviceId":"353075615681",
"reportCt":1735296575,
"deviceCt":1735296575,
"alarmType":"laneShift",
"id":"353075615681_1843895343409950720",
"alarmId":"1843895343409950720",
"lat":24.067906,
"lon":76.96842
}
You can query the alarm file corresponding to the alarm ID through 'alarm/alarmFileByAlarmId'.
GPS Data
Field | Type | Required | Note |
---|---|---|---|
actual | boolean | true | Real time or supplementary transmission |
deviceId | string | true | Device ID |
reportCt | number | true | Device Data reporting time (Device Time Zone) |
deviceCt | number | true | Gateway Data reporting time (UTC +0) |
num | integer | true | number of satellites |
lon | number | false | |
lat | number | false | |
speed | number | false | |
course | integer | false | indicates the direction of travel |
id | string | true | Unique ID, if it matches the ID in GPS, it indicates that the information attached to this GPS package |
"data":
{
"actual":true,
"num":9,
"lon":113.93870899999999,
"deviceId":"123456789012",
"speed":0,
"reportCt":1724822445,
"course":154,
"deviceCt":1724793630,
"id":"123456789012_1234567893043003392",
"lat":22.577894
}
DeviceInfo Data
Field | Type | Required | Note |
---|---|---|---|
actual | boolean | true | Real time or supplementary transmission |
deviceId | string | true | Device ID |
reportCt | number | true | Device Data reporting time (Device Time Zone) |
deviceCt | number | true | Gateway Data reporting time (UTC +0) |
acc | integer | false | Acc status 0 off/1 on |
blockedStatus | integer | false | Oil and electricity status 0 off/1 on |
odometer | number | false | Mileage Statistics |
elec | integer | false | Power on status 0 off/1 on |
ioStatus | integer | false | I/O status |
signal | integer | false | GSM signal strength |
voltage | number | false | voltage V,External voltage, only valid for wired devices |
quantity | number | false | Percentage of battery |
id | string | true | Unique ID, if it matches the ID in GPS, it indicates that the information attached to this GPS package |
"data":
{
"acc":1,
"actual":true,
"blockedStatus":1,
"odometer":7.3,
"elec":0,
"deviceId":"123456789012",
"reportCt":1724837171,
"ioStatus":0,
"deviceCt":1724808355,
"id":"123456789012_1234567895482220544",
"signal":27
}
PassThrough Data
Field | Type | Required | Note |
---|---|---|---|
message | string | true | JSON string containing com1 and com2 |
deviceId | string | true | Device ID |
reportCt | number | true | Device Data reporting time (Device Time Zone) |
deviceCt | number | true | Gateway Data reporting time (UTC +0) |
id | string | true | Unique ID, if it matches the ID in GPS, it indicates that the information attached to this GPS package |
"data": {
"message": "{\"com1\":\"f5fffff5d7dff5f5fff5fdd5ffdffddfd5dffdff7ddddfd5ffdfd5ffdfffd5fdf7dfddd5fdf5f5ffddd5f7\",\"com2\":\"fffddffffff5ff55f5fffd5dfff5dffff555dddfd7ffffd5ffdffdffd7dfffd5dffffffdffdfff7dddffdfd7ddddfff7dfdddfdffff5f7fdf5ffdddfddffd5d7ffdffdffdfddfdfff5fd5dfff7f5dffd\"}",
"deviceId": "333845765947",
"reportCt": 1736756976,
"deviceCt": 1736756976,
"id": "333845765947_1878721045339443200"
}
- Sample code for receiving URL implementation
@PostMapping(value = "/device/info")
public String deviceInfo(HttpServletRequest request) {
Map<String, Object> headerMap = new HashMap<>();
request.getHeaderNames().asIterator().forEachRemaining(
headerName -> headerMap.put(headerName, request.getHeader(headerName))
);
headerMap.forEach((key, value) -> System.out.println(key + ": " + value));
Map<String, Object> parameterMap = new HashMap<>();
Enumeration<String> parameterNames = request.getParameterNames();
while (parameterNames.hasMoreElements()) {
String paramName = parameterNames.nextElement();
parameterMap.put(paramName, request.getParameter(paramName));
}
parameterMap.forEach((key, value) -> System.out.println(key + ": " + value));
return "success";
}
const express = require("express");
const app = express();
const port = 19998;
// Middleware to parse URL-encoded bodies
app.use(express.urlencoded({ extended: true }));
app.post("/v2/test/push/device/info", (req, res) => {
const parameterMap = {};
// Iterate over request parameters
for (const key in req.body) {
if (req.body.hasOwnProperty(key)) {
parameterMap[key] = req.body[key];
}
}
// Print the parameters to the console
for (const [key, value] of Object.entries(parameterMap)) {
console.log(`${key}: ${value}`);
}
res.send("success");
});
app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}/v2/test/push/device/info`);
});
Last modified: 13 分钟前