Devices API
The Devices API allows for managing devices by fetching a list of devices, creating, updating, and deleting device entries. It also provides functionality for updating the total distance and hours for a device.
Fetch a List of Devices
Retrieves a list of devices based on user authorization and parameters.
🛠Endpoint:
GET /devices
Authorization:
- Requires Basic Authentication (
basicAuth
)
Query Parameters:
Parameter | Type | Description |
---|---|---|
all |
boolean |
Can only be used by admins or managers to fetch all entities. |
userId |
integer |
Standard users can use this only with their own userId. |
id |
integer |
To fetch one or more devices. Multiple id parameters can be passed (e.g., id=31&id=42 ). |
uniqueId |
string |
To fetch one or more devices. Multiple uniqueId parameters can be passed (e.g., uniqueId=333331&uniqueId=44442 ). |
cURL Request:
# Using Basic Auth
curl -u username:password -X GET "https://itsochvts.com/api/devices" \
-H "Content-Type: application/json"
# Using Cookie
curl -X GET "https://itsochvts.com/api/devices" \
-H "Content-Type: application/json" \
-H "Cookie: JSESSIONID=your_session_id"
200 OK - Response Body
[
{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}
]
Create a Device
Creates a new device entry.
🛠Endpoint:
POST /devices
Authorization:
- Requires Basic Authentication (
basicAuth
)
cURL Request:
# Using Basic Auth
curl -u username:password -X POST "https://itsochvts.com/api/devices" \
-H "Content-Type: application/json" \
-d '{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}'
# Using Cookie
curl -X POST "https://itsochvts.com/api/devices" \
-H "Content-Type: application/json" \
-H "Cookie: JSESSIONID=your_session_id" \
-d '{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}'
Request Body:
{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}
200 OK - Response Body
{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}
Update a Device
Updates the details of an existing device.
🛠Endpoint:
PUT /devices/{id}
Authorization:
- Requires Basic Authentication (
basicAuth
)
Path Parameters:
Parameter | Type | Description |
---|---|---|
id |
integer |
The device ID to update. |
cURL Request:
# Using Basic Auth
curl -u username:password -X PUT "https://itsochvts.com/api/devices/{id}" \
-H "Content-Type: application/json" \
-d '{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}'
# Using Cookie
curl -X PUT "https://itsochvts.com/api/devices/{id}" \
-H "Content-Type: application/json" \
-H "Cookie: JSESSIONID=your_session_id" \
-d '{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}'
Request Body:
{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}
200 OK - Response Body
{
"id": 0,
"name": "string",
"uniqueId": "string",
"status": "string",
"disabled": true,
"lastUpdate": "2025-02-18T07:22:23Z",
"positionId": 0,
"groupId": 0,
"phone": "string",
"model": "string",
"contact": "string",
"category": "string",
"attributes": {}
}
Delete a Device
Deletes a device entry.
🛠Endpoint:
DELETE /devices/{id}
Authorization:
- Requires Basic Authentication (
basicAuth
)
Path Parameters:
Parameter | Type | Description |
---|---|---|
id |
integer |
The device ID to delete. |
cURL Request:
# Using Basic Auth
curl -u username:password -X DELETE "https://itsochvts.com/api/devices/{id}" \
-H "Content-Type: application/json"
# Using Cookie
curl -X DELETE "https://itsochvts.com/api/devices/{id}" \
-H "Content-Type: application/json" \
-H "Cookie: JSESSIONID=your_session_id"
204 No Content
Update Total Distance and Hours of the Device
Updates the total distance and hours of a device.
🛠Endpoint:
PUT /devices/{id}/accumulators
Authorization:
- Requires Basic Authentication (
basicAuth
)
Path Parameters:
Parameter | Type | Description |
---|---|---|
id |
integer |
The device ID to update. |
cURL Request:
# Using Basic Auth
curl -u username:password -X PUT "https://itsochvts.com/api/devices/{id}/accumulators" \
-H "Content-Type: application/json" \
-d '{
"deviceId": 0,
"totalDistance": 0,
"hours": 0
}'
# Using Cookie
curl -X PUT "https://itsochvts.com/api/devices/{id}/accumulators" \
-H "Content-Type: application/json" \
-H "Cookie: JSESSIONID=your_session_id" \
-d '{
"deviceId": 0,
"totalDistance": 0,
"hours": 0
}'
Request Body:
{
"deviceId": 0,
"totalDistance": 0,
"hours": 0
}