Machine states

GET /api/machines/states/

Get all state definitions.

Returns:

an object mapping state definition ID to state definition object

PUT /api/machines/states/

Create a new state definition.

Reqjson:

a (partial) state definition, with at least name set

Status Codes:
Returns:

the new MachineStateDef object

PATCH /api/machines/states/(int: state_def_id)

Edit an existing state definition.

Parameters:
  • state_def_id – the ID of the state definition to edit

Status Codes:
  • 404 Not Found – if the state definition does not exist

  • 403 Forbidden – if the new machine_states array contains a machine state that is already mapped

Reqjson:

a (partial) MachineStateDef object

Returns:

the modified MachineStateDef object

DELETE /api/machines/states/(int: state_def_id)

Delete an existing machine state definition.

Parameters:
  • state_def_id – the ID of the state definition to delete

Status Codes:
POST /api/machines/states/(int: source_state_def_id)/merge/(int: target_state_def_id)

Merge an existing machine state definition into another one.

This will transfer all machine states from the source state definition into the target state definition and then delete the source state definition. Any state history blocks using the source definition will be reassigned to the target definition.

Parameters:
  • source_state_def_id – the ID of the state definition to merge and delete

  • target_state_def_id – the ID of the state definition to merge the source into

Status Codes:
  • 404 Not Found – if either of the source or target state definition IDs is invalid

Returns:

the new state of the target state definition object