Commands
The Commands API enables managing and sending commands to devices, including saving commands, retrieving command lists, and dispatching commands to devices.
Data Schema
Field | Type | Description |
---|---|---|
id |
integer |
Command ID |
deviceId |
integer |
Target device ID |
description |
string |
Command description |
type |
string |
Command type |
attributes |
object |
Additional command attributes |
Fetch Commands
Retrieves a list of saved commands based on specified filters.
🛠Endpoint:
GET /commands
Authorization:
- Requires Basic Authentication (
basicAuth
)
Query Parameters:
Parameter | Type | Description |
---|---|---|
all |
boolean |
Fetch all commands (admin/manager only) |
userId |
integer |
Filter by user ID |
deviceId |
integer |
Filter by device ID |
groupId |
integer |
Filter by group ID |
refresh |
boolean |
Refresh commands data |
cURL Request:
curl -u username:password -X GET "https://itsochvts.com/api/commands" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json"
200 OK - Response Body
[
{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}
]
Create Command
Creates a new saved command.
🛠Endpoint:
POST /commands
Authorization:
- Requires Basic Authentication (
basicAuth
)
Request Body:
{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}
cURL Request:
curl -u username:password -X POST "https://itsochvts.com/api/commands" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json" \
-d '{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}'
200 OK - Response Body
{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}
Update Command
Updates an existing saved command.
🛠Endpoint:
PUT /commands/{id}
Authorization:
- Requires Basic Authentication (
basicAuth
)
Path Parameters:
Parameter | Type | Description |
---|---|---|
id |
integer |
Command ID to update |
Request Body:
{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}
cURL Request:
curl -u username:password -X PUT "https://itsochvts.com/api/commands/1" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json" \
-d '{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}'
200 OK - Response Body
{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}
Delete Command
Deletes a saved command.
🛠Endpoint:
DELETE /commands/{id}
Authorization:
- Requires Basic Authentication (
basicAuth
)
Path Parameters:
Parameter | Type | Description |
---|---|---|
id |
integer |
Command ID to delete |
cURL Request:
curl -u username:password -X DELETE "https://itsochvts.com/api/commands/1" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json"
204 No Content
Supported Commands
Get Supported Commands
Retrieves commands supported by a specific device.
🛠Endpoint:
GET /commands/send
Query Parameters:
Parameter | Type | Description |
---|---|---|
deviceId |
integer |
Target device ID |
cURL Request:
curl -u username:password -X GET "https://itsochvts.com/api/commands/send?deviceId=1" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json"
Send Command
Dispatches a command to a device.
🛠Endpoint:
POST /commands/send
Request Body:
{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}
cURL Request:
curl -u username:password -X POST "https://itsochvts.com/api/commands/send" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json" \
-d '{
"id": 0,
"deviceId": 0,
"description": "string",
"type": "string",
"attributes": {}
}'
Response Codes:
200 OK
: Command sent successfully202 Accepted
: Command queued400 Bad Request
: Permission/type error
Get Command Types
Retrieves available command types.
🛠Endpoint:
GET /commands/types
Query Parameters:
Parameter | Type | Description |
---|---|---|
deviceId |
integer |
Filter by device |
protocol |
string |
Filter by protocol |
textChannel |
boolean |
SMS commands if true |
cURL Request:
curl -u username:password -X GET "https://itsochvts.com/api/commands/types" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json"
200 OK - Response Body
[
{
"type": "string"
}
]