Rules
API endpoints for Rules management in IOTSP.
Add a rule
http
POST /v1/iotsp/rules/addHeaders
- origin (required)
- de-user-agent (required)
- de-auth-token (required)
- de-auth-device (required)
Request Body
typescript
interface Add a ruleRequest {
type: string;
reference: string;
description: string;
head: string[];
struct: string;
schema: {
protocol.version: {
type: string;
unit: string;
description: string;
sources: any[]
};
device.id: {
type: string;
unit: string;
description: string;
sources: any[]
};
device.name: {
type: string;
unit: string;
description: string;
sources: any[]
};
device.state: {
type: string;
unit: string;
description: string;
sources: any[]
};
report.type: {
type: string;
unit: string;
description: string;
sources: any[]
};
position.altitude: {
type: string;
unit: string;
description: string;
sources: any[]
};
position.direction: {
type: string;
unit: string;
description: string;
sources: any[]
};
position.accuracy: {
type: string;
unit: string;
description: string;
sources: any[]
};
position.latitude: {
type: string;
unit: string;
description: string;
sources: any[]
};
position.longitude: {
type: string;
unit: string;
description: string;
sources: any[]
};
position.speed: {
type: string;
unit: string;
description: string;
sources: any[]
};
position.time: {
type: string;
unit: string;
description: string;
sources: any[]
};
gsm.cellid: {
type: string;
unit: string;
description: string;
sources: any[]
};
gsm.lac: {
type: string;
unit: string;
description: string;
sources: any[]
};
gsm.mcc: {
type: string;
unit: string;
description: string;
sources: any[]
};
gsm.mnc: {
type: string;
unit: string;
description: string;
sources: any[]
};
gsm.csq: {
type: string;
unit: string;
description: string;
sources: any[]
};
gsm.network.type: {
type: string;
unit: string;
description: string;
sources: any[]
};
backup.battery.level: {
type: string;
unit: string;
description: string;
sources: any[]
};
backup.battery.voltage: {
type: string;
unit: string;
description: string;
sources: any[]
};
battery.level: {
type: string;
unit: string;
description: string;
sources: any[]
};
battery.supply.type: {
type: string;
unit: string;
description: string;
sources: any[]
};
battery.voltage: {
type: string;
unit: string;
description: string;
sources: any[]
};
ecu.lock.status: {
type: string;
unit: string;
description: string;
sources: any[]
};
ecu.error.code: {
type: string;
unit: string;
description: string;
sources: any[]
};
ecu.error.type: {
type: string;
unit: string;
description: string;
sources: any[]
};
ecu.info: {
type: string;
unit: string;
description: string;
sources: any[]
};
device.time: {
type: string;
unit: string;
description: string;
sources: any[]
};
device.count: {
type: string;
unit: string;
description: string;
sources: any[]
}
};
}Example:
json
{
"type": "REPORT",
"reference": "realtime-operation.report",
"description": "Normalize all realtime operation reports",
"head": [
"+RESP:GTNCN",
"+RESP:GTFRI",
"+RESP:GTSTT",
"+RESP:GTULS",
"+RESP:GTRTL"
],
"struct": "HEAD,{protocol.version},{device.id},{device.name},,,,,{report.type},{ecu.error.code},{position.accuracy},{position.speed},{position.zimuth},{position.altitude},{position.longitude},{position.latitude},{position.time},,{gsm.mcc},{gsm.mnc},{gsm.lac},{gsm.cellid},{gsm.csq},{gsm.network.type},{device.state},{battery.supply.type},{battery.voltage},{backup.battery.voltage},{backup.battery.level},{ecu.error.type},,{ecu.lock.state},,{ecu.info},{battery.level},{device.time},{device.count}$",
"schema": {
"protocol.version": {
"type": "string",
"unit": "",
"description": "Protocol version",
"sources": []
},
"device.id": {
"type": "string",
"unit": "",
"description": "Device IMEI number",
"sources": []
},
"device.name": {
"type": "string",
"unit": "",
"description": "Vehicle's factory id",
"sources": []
},
"device.state": {
"type": "number",
"unit": "",
"description": "Vehicle's state. (Stationary or motion)",
"sources": []
},
"report.type": {
"type": "boolean",
"unit": "",
"description": "Indicate the report type",
"sources": []
},
"position.altitude": {
"type": "number",
"unit": "meters",
"description": "Altitude value for position",
"sources": []
},
"position.direction": {
"type": "number",
"unit": "degrees",
"description": "Heading angle at position detection moment (The azimuth from GPS)",
"sources": []
},
"position.accuracy": {
"type": "number",
"unit": "",
"description": "(HDOP) Horizontal dilution of precision",
"sources": []
},
"position.latitude": {
"type": "number",
"unit": "degrees",
"description": "Latitude coordinate value",
"sources": []
},
"position.longitude": {
"type": "number",
"unit": "degrees",
"description": "Longitude coordinate value",
"sources": []
},
"position.speed": {
"type": "number",
"unit": "km/h",
"description": "Instant speed at position detection moment",
"sources": []
},
"position.time": {
"type": "number",
"unit": "seconds",
"description": "Timestamp when coordinates where calculated",
"sources": []
},
"gsm.cellid": {
"type": "number",
"unit": "",
"description": "Mobile network (GSM, 3G, 4G, LTE, 5G, ...) base station ID",
"sources": []
},
"gsm.lac": {
"type": "number",
"unit": "",
"description": "Mobile network (GSM, 3G, 4G, LTE, 5G, ...) location area code",
"sources": []
},
"gsm.mcc": {
"type": "number",
"unit": "",
"description": "Mobile network (GSM, 3G, 4G, LTE, 5G, ...) country code",
"sources": []
},
"gsm.mnc": {
"type": "number",
"unit": "",
"description": "Mobile network (GSM, 3G, 4G, LTE, 5G, ...) code",
"sources": []
},
"gsm.csq": {
"type": "number",
"unit": "",
"description": "",
"sources": []
},
"gsm.network.type": {
"type": "number",
"unit": "",
"description": "The type of the Mobile network the device is currently registered to",
"sources": []
},
"backup.battery.level": {
"type": "number",
"unit": "percentage",
"description": "Backup battery level",
"sources": []
},
"backup.battery.voltage": {
"type": "number",
"unit": "volts",
"description": "Backup battery voltage",
"sources": []
},
"battery.level": {
"type": "number",
"unit": "percentage",
"description": "Internal battery level",
"sources": []
},
"battery.supply.type": {
"type": "boolean",
"unit": "",
"description": "Current vehicle's power supply state (Main or Backup)",
"sources": []
},
"battery.voltage": {
"type": "number",
"unit": "volts",
"description": "Internal battery voltage",
"sources": []
},
"ecu.lock.status": {
"type": "boolean",
"unit": "",
"description": "ECU lock status: true - locked, false - unlocked",
"sources": []
},
"ecu.error.code": {
"type": "string",
"unit": "",
"description": "ECU error code",
"sources": []
},
"ecu.error.type": {
"type": "number",
"unit": "",
"description": "ECU error type",
"sources": []
},
"ecu.info": {
"type": "string",
"unit": "",
"description": "Compacted details on ECU",
"sources": []
},
"device.time": {
"type": "number",
"unit": "",
"description": "Timestamp when message is sent from the device",
"sources": []
},
"device.count": {
"type": "string",
"unit": "",
"description": "Count number",
"sources": []
}
}
}Get a rule specs
http
GET /v1/iotsp/rules/:referenceHeaders
- origin (required)
- de-user-agent (required)
- de-auth-token (required)
- de-auth-device (required)
Find a rule
http
GET /v1/iotsp/rules/find?query=positionHeaders
- origin (required)
- de-user-agent (required)
- de-auth-token (required)
- de-auth-device (required)
Get all rules
http
GET /v1/iotsp/rules?type=REPORTHeaders
- origin (required)
- de-user-agent (required)
- de-auth-token (required)
- de-auth-device (required)
Update rule specs
http
PATCH /v1/iotsp/rules/:referenceHeaders
- origin (required)
- de-user-agent (required)
- de-auth-token (required)
- de-auth-device (required)
Request Body
typescript
interface Update rule specsRequest {
tags: string[];
}Example:
json
{
"tags": [
"dev",
"debug"
]
}Update rule status
http
PATCH /v1/iotsp/rules/:reference/:statusHeaders
- origin (required)
- de-user-agent (required)
- de-auth-token (required)
- de-auth-device (required)
Remove rule
http
DELETE /v1/iotsp/rules/:referenceHeaders
- origin (required)
- de-user-agent (required)
- de-auth-token (required)
- de-auth-device (required)
Assign rule to an IoT Connector type
http
PUT /v1/iotsp/rules/:reference/connector/assignHeaders
- de-auth-token (required)
- de-auth-device (required)
- de-user-agent (required)
Unassign rule from an IoT Connector type
http
PATCH /v1/iotsp/rules/:reference/connector/unassignHeaders
- de-auth-token (required)
- de-auth-device (required)
- de-user-agent (required)
Get connectors using this rule
http
GET /v1/iotsp/rules/:reference/connectorsHeaders
- de-auth-token (required)
- de-auth-device (required)
- de-user-agent (required)

