13.5. Performing actions on virtual machines

POST /servers/{server_id}/action

Perform an action on a virtual machine with the specified ID.

The request parameters depend on the action. For the list of parameters, follow the “source” link below.

Source: https://docs.openstack.org/api-ref/compute/?expanded=#servers-run-an-action-servers-action

13.5.1. Request

13.5.1.1. Examples

Suspend a VM with the specified ID.

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
    "suspend": null
}' https://<node_IP_addr>:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/servers/c3f154f1-c656-49b4-a6c0-4dd1e088817c/action

Resume a VM with the specified ID.

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
    "resume": null
}' https://<node_IP_addr>:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/servers/c3f154f1-c656-49b4-a6c0-4dd1e088817c/action

13.5.2. Response

13.5.2.1. Status codes

13.5.2.1.1. Success

Code Reason
202 - Accepted Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

13.5.2.1.2. Error

Code Reason
401 - Unauthorized User must authenticate before making a request.
403 - Forbidden Policy does not allow current user to do this operation.
404 - Not Found The requested resource could not be found.
409 - Conflict This operation conflicted with another operation on this resource.