An Anomaly is something that deviates from what is standard, normal, or expected.
The Anomaly API allows the administrator to create, view and manage a set of common anomalies for each device.
All the vocabulary used in the anomalies representations is described here.
List the anomalies of a specific device.
GET /devices/{deviceId}/anomalies| Name | Type | In | Required | Description |
|---|---|---|---|---|
deviceId |
integer | path | yes | Identifier of the device. |
accept |
string | header | no | Setting to application/vnd.qrreport+json is recommended. |
page |
integer | query | no | Page number of the results to fetch. Default: 1 |
Status: 200 OK {
"class": [ "anomaly", "collection" ],
"properties": {
"pageIndex": 1,
"pageMaxSize": 10,
"collectionSize": 1
},
"entities": [
{
"class": [ "anomaly" ],
"rel": [ "item" ],
"properties": {
"id": 1,
"anomaly": "Broken toilet"
},
"actions": [
{
"name": "update-anomaly",
"title": "Update anomaly",
"method": "PUT",
"href": "/devices/1/anomalies/1",
"type": "application/json",
"properties": [
{ "name": "anomaly", "type": "string" }
]
},
{
"name": "delete-anomaly",
"title": "Delete anomaly",
"method": "DELETE",
"href": "/devices/1/anomalies/1"
}
],
"links": [
{ "rel": [ "self" ], "href": "/devices/1/anomalies/1" }
]
}
],
"actions": [
{
"name": "create-anomaly",
"title": "Create anomaly",
"method": "POST",
"href": "/devices/1/anomalies",
"type": "application/json",
"properties": [
{ "name": "anomaly", "type": "string" }
]
}
],
"links": [
{ "rel": [ "self" ], "href": "/devices/1/anomalies?page=1" },
{ "rel": [ "pagination" ], "href": "/devices/1/anomalies{?page}", "templated": true }
]
}Status: 400 Bad RequestStatus: 401 UnauthorizedStatus: 403 ForbiddenStatus: 404 Not FoundCreate a new anomaly for a specific device.
POST /devices/{deviceId}/anomalies| Name | Type | In | Required | Description |
|---|---|---|---|---|
deviceId |
integer | path | yes | Identifier of the device. |
accept |
string | header | no | Setting to application/vnd.qrreport+json is recommended. |
content-type |
string | header | yes | Set to application/json. |
anomaly |
string | body | yes | Unique anomaly. |
Status: 201 Created
Location: /devices/{deviceId}/anomalies{
"class": [ "anomaly" ],
"properties": {
"id": 1,
"anomaly": "Broken toilet"
},
"links": [
{ "rel": [ "device-anomalies" ], "href": "/devices/1/anomalies" }
]
}Status: 400 Bad RequestStatus: 401 UnauthorizedStatus: 403 ForbiddenStatus: 409 Conflicttype: unique-constraint
Update the anomaly subject.
PUT /devices/{deviceId}/anomalies/{anomalyId}| Name | Type | In | Required | Description |
|---|---|---|---|---|
deviceId |
integer | path | yes | Identifier of the device. |
anomalyId |
integer | path | yes | Identifier of the anomaly. |
accept |
string | header | no | Setting to application/vnd.qrreport+json is recommended. |
content-type |
string | header | yes | Set to application/json. |
anomaly |
string | body | yes | New unique anomaly for the device. |
Status: 200 OK {
"class": [ "anomaly" ],
"properties": {
"id": 1,
"name": "Broken toilet with water problem"
},
"links": [
{ "rel": [ "device-anomalies" ], "href": "/devices/1/anomalies" }
]
}Status: 400 Bad RequestStatus: 401 UnauthorizedStatus: 403 ForbiddenStatus: 404 Not FoundStatus: 409 Conflicttype: unique-constraint
Delete an anomaly on a specific device.
DELETE /devices/{deviceId}/anomalies/{anomalyId}| Name | Type | In | Required | Description |
|---|---|---|---|---|
deviceId |
integer | path | yes | Identifier of the device. |
anomalyId |
integer | path | yes | Identifier of the anomaly. |
accept |
string | header | no | Setting to application/vnd.qrreport+json is recommended. |
Status: 200 OK {
"class": [ "anomaly" ],
"properties": {
"id": 1,
"anomaly": "Broken toilet"
},
"links": [
{ "rel": [ "device-anomalies" ], "href": "/devices/1/anomalies" }
]
}Status: 400 Bad RequestStatus: 401 UnauthorizedStatus: 403 ForbiddenStatus: 404 Not Found| Name | Type | Description |
|---|---|---|
id |
number | Unique identifier of the anomaly. Must be greater than 0. |
anomaly |
string | Unique subject for an anomaly of a specific device, but not globally unique. |
| Name | Description |
|---|---|
device-anomalies |
Set of anomalies that belong to the device. |
The vocabulary about the devices can be consulted here.
The documentation for the media-type, classes, standard link relations and generic errors used in the representations are described here.