9. Actions
9.1 System Reset
Actions are used for operations that do not map easily to CRUD (create, read, update, and delete) semantics. For example, performing a reset of a device is not as simple as modifying a desired property since a reset operation will likely start various sequences and state transitions internal to the device, which will cause many other properties in the model to change.
The Actions
property in a resource is an object that contains the available actions that can be performed on the resource. Each property inside of the Actions
property represents one of the actions supported on the resource. It also contains properties that describe the supported parameters and parameter values for each action. Clients can perform a POST
operation on the action URI to invoke the action.
The following example shows the supported actions for a ComputerSystem
resource found at the URI /redfish/v1/Systems/1
:
{
"@odata.id": "/redfish/v1/Systems/1",
"@odata.type": "#ComputerSystem.v0_0_1.ComputerSystem",
"Id": "1",
"Name": "avtoob_000001",
"Actions": {
"#ComputerSystem.Reset": {
"target": "/redfish/v1/Systems/1/Actions/ComputerSystem.Reset",
"ResetType@Redfish.AllowableValues": [
"On",
"ForceOff",
"ForceRestart",
" GracefulShutdown "
]
}
},
... <Other ComputerSystem properties>
}
In the previous example, there is one action supported named #ComputerSystem.Reset
. The target
property contains the URI on which the client performs the POST
operation. It also contains ResetType@Redfish.AllowableValues
to show the supported values for the ResetType
parameter. A user can perform a graceful restart of the system with the following request:
curl -k -X POST 'https://<REDFISH-HOST>/redfish/v1/Systems/1/Actions/ComputerSystem.Reset' \
-H "Content-Type: application/json" -H 'X-Auth-Token: <SESSION-TOKEN>' \
-d '{ "ResetType": "ForceRestart" }'
Response:
9.2 Camera Action
curl -k -X POST 'https://<REDFISH-HOST>/redfish/v1/Systems/1/Oem/Camera/Actions/Camera.Active' \
-H "Content-Type: application/json" -H 'X-Auth-Token: <SESSION-TOKEN>' \
-d '{ "ActivetType": "StreamStart" }'