Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Examples > Servers > Terminate Server

Terminate Server

Terminate the running instance of a server.

icon_curl_v1.png    icon_rs_api_client_v1.png

Table of Contents

Curl

Prerequisite:  Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.

Example Call

#!/bin/sh -e
SERVER="532922001"
curl -i -H X_API_VERSION:1.5 -b mycookie -X POST https://my.rightscale.com/api/servers/$SERVER/terminate

Sample Output

Note:  There is no XML/JSON content from a Terminate Server (or instance).

HTTP/1.1 204 No Content
Server: nginx/1.0.15
Date: Fri, 12 Oct 2012 16:18:49 GMT
Connection: keep-alive
Status: 204 No Content
X-Runtime: 463
X-Request-Uuid: cbb45a90192a4e75b8580e8f0ff5674f
Set-Cookie: _session_id=92ede080c999a3e5734035f582d11b0e; path=/; Secure; HttpOnly
Cache-Control: no-cache

right_api_client

Example Call

require 'rubygems'
require 'pp'                          # Require pretty print Ruby gem
require 'right_api_client'            # RightScale API client gem

user = 'greg.doe@example.com'         # Set user email address for using the Dashboard
acct = '1234'                         # Set the account ID
pass = 'SomePassword'                 # Set the password for the user.  Create client object so you can use the API.
@client = RightApi::Client.new(:email => user, :password => pass, :account_id => acct)
#
# Setup and authenticate above. Set and use additional variables below, display output, etc.
#
server_id = '626129001'
@client.servers(:id => server_id).show.terminate

Sample Output

The specified server is terminated, but no output.  (Note: Even if the example script above used "puts" or "pp" to display output, none is returned.)

You must to post a comment.
Last modified
14:20, 30 May 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.