Stop server

Overview

Stops a running server and changes its status to STOPPED.

Classification

  • Stop

API Operation Object

  • action

Synchronous / Asynchronous

  • asynchronous

Request

HTTP Request Method

  • POST

HTTP Request Path

{api_endpoint}/v2/{project_id}/servers/{server_id}/action

HTTP Request Header

Format

Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: <token_id>
Content-Type: application/json

HTTP Request Body

Format

{
    "os-stop" : null
}

Request Parameter

Request Parameters
name style format description required/optional default value action for invalid parameter response code for invalid parameter
project_id URL UUID(3) Project id required - Terminate 400, 404
server_id URL UUID String instance id required - Terminate 404
token_id Header authentication token string keystone authentication token required - Terminate 401

Response

HTTP Response Header

Format

HTTP/1.1 <response_code> <message>       (ex. 202 Accepted)
  • <response_code>: see "HTTP Responses" section

  • <message>: message based on the response code

    • skip auto insert field such as "X-Compute-Request-Id" and "Content-Length", "Date"

Response Code

Response Codes
response code condition
202 normal end
400 invalid project_id
- task_state is invalid (internal error)
- launch_at is none (internal_error)
401 unauthorized
404 not found a specified instance
- not found a specified project
409 vm_state isn't ACTIVE or ERROR

HTTP Response Body

Format

  • none

Response Parameter

Response Parameters
item format description
none - -

Sample API Request and Response

Sample API Request

Request URI

https://example.com/v2/{project_id}/servers/{server_id}/action

Request Header

Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: ajk3adjiown02
Content-Type: application/json

Request Body

{
    "os-stop" : null
}

Sample API Response

Response Header

HTTP/1.1 202 Accepted
  • <response_code>: see "HTTP Responses" section

  • <message>: message based on the response code

    • skip auto insert field such as "X-Compute-Request-Id" and "Content-Length", "Date"

Response Body

  • none

Execution Example

HTTP Request

POST /v2/b72dc11461c84102b97576ae24d2b88c/servers/0199340e-0f3e-4612-96be-6f1861b192b5/action HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.150.51:8774
Accept-Encoding: gzip, deflate, compress
Accept: application/json
X-Auth-Token: 712c5401c6764878a2d706675e0a6319
Content-Type: application/json
Content-Length: 20

{ "os-stop" : null }

HTTP Response

HTTP/1.1 202 Accepted
Content-Type: text/html; charset=UTF-8
Content-Length: 0
X-Compute-Request-Id: req-a9f37c55-9161-4016-aa31-df4bb6036941
Date: Thu, 31 Jul 2014 08:49:29 GMT

Error Execution Example

HTTP Request

POST /v2/295f0b8574504834bd6249d91dbd5a9c/servers/fd2caaa0-cdcb-4f43-bd65-2bdbe29e06b1/action HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token:cd08bf66ed2044c0ae07458cfeb42e82
Content-type: application/json
Accept: application/json
Content-Length: 15

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 188
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-a551a412-b723-46f7-9b37-861c601495a1
Date: Thu, 08 Oct 2015 09:27:16 GMT

{"badRequest": {"message": "Malformed request URL: URL's project_id '295f0b8574504834bd6249d91dbd5a9c' doesn't match Context's project_id '895f0b8574504834bd6249d91dbd5a9c'", "code": 400}}