Create a new deployment.
Table of Contents
Prerequisite: Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.
#!/bin/sh -e curl -i -H X_API_VERSION:1.5 -b mycookie -X POST \ -d deployment[name]="Deployment for API Sandbox" \ -d deployment[description]="Sandbox for miscellaneous API tests" \ https://my.rightscale.com/api/deployments.xml
HTTP/1.1 201 Created Server: nginx/1.0.15 Date: Thu, 25 Oct 2012 18:33:36 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Status: 201 Created Location: /api/deployments/314837001 X-Runtime: 292 X-Request-Uuid: ecf7f1ed401b48a4b98de27d894389db Set-Cookie: _session_id=b8112ab3a540a2cf0a81ce64be2c3e38; path=/; Secure; HttpOnly Cache-Control: no-cache
Prerequisite: Example assumes you have previously authenticated and your session cookie for subsequent requests is in 'cookieContainer'.
#get cookie container from authentication $cookieContainer $deploymentName = "Deployment for API Sandbox" $deploymentDescription = "Sandbox for Miscellaneous API Tests" $postString = "deployment[name]=""$deploymentName""&deployment[description]=$deploymentDescription" $postBytes = [System.Text.Encoding]::UTF8.GetBytes($postString) $createDeploymentRequest = [System.Net.WebRequest]::Create("https://my.rightscale.com/api/deployments.xml") $createDeploymentRequest.Method = "POST" $createDeploymentRequest.CookieContainer = $cookieContainer $createDeploymentRequest.Headers.Add("X_API_VERSION", "1.5"); $createDeploymentRequestStream = $createDeploymentRequest.GetRequestStream() $createDeploymentRequestStream.Write($postBytes, 0, $postBytes.Length) $createDeploymentRequestStream.Close() [System.Net.WebResponse] $createDeploymentResponse = $createDeploymentRequest.GetResponse() $createDeploymentResponseStream = $createDeploymentResponse.GetResponseStream() $createDeploymentResponseStreamReader = New-Object System.IO.StreamReader -argumentList $createDeploymentResponseStream [string]$createDeploymentResponseString = $createDeploymentResponseStreamReader.ReadToEnd()
IsMutuallyAuthenticated : False Cookies : {} Headers : {Transfer-Encoding, Connection, Status, X-Runtime...} SupportsHeaders : True ContentLength : -1 ContentEncoding : ContentType : text/html; charset=utf-8 CharacterSet : utf-8 Server : nginx/1.0.15 LastModified : 2/21/2013 12:54:34 PM StatusCode : Created StatusDescription : Created ProtocolVersion : 1.1 ResponseUri : https://my.rightscale.com/api/deployments.xml Method : POST IsFromCache : False
See the Create Deployment example (RightScale API 1.6 Guide: Appendix A - APEye Tools > Google Chrome Postman Plugin)
© 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.