I have a resource which represents a set of physical devices.
Calling GET v1/devices/
yields the following result:
[
{
"MacAddress": "DD-22-33-15-15-66",
"Name": "Test Device",
"State": "Approved"
},
{
"MacAddress": "E5-21-56-44-11-B6",
"CompanyId": "Another Test Device",
"State": "Pending"
}
]
A device has a state (an important attribute) which can only be pending
or approved
, and so the following GET requests are also available:
GET v1/devices/pending
: Retrieves all pending devicesGET v1/devices/approved
: Retrieves all approved devices
You can also get an individual device from the resource using GET v1/devices/EF-55-33-44-54-61
I now want to be able to update only the state of a device from Pending
to Approved
.
Would the following PATCH call make sense?
PATCH v1/devices/EF-55-33-44-54-61/approve
From some reading, it would seem the proper way to do it would be something like this:
[
{"replace": "/state", "value": "approved"}
]
But this seems too flexible for such a specific update. I never want other values to be updated and I also don't want the state to be changed in any other way.