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 > ServerTemplates > List ServerTemplates and MCI Associations

List ServerTemplates and MCI Associations

List all ServerTemplates and their associated MultiCloud Image associations for the current account.

 

Table of Contents

Curl

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

Example Call

Warning:  Depending on the account and cloud resources involved, this can be an expensive (resource intensive) call. 

#!/bin/sh
curl -i -H X_API_VERSION:1.5 -b mycookie -X GET https://my.rightscale.com/api/server_template_multi_cloud_images.xml

Sample Output

Note:  HTTP headers not displayed.  Output truncated.

<?xml version="1.0" encoding="UTF-8"?>
<server_template_multi_cloud_images>
  <server_template_multi_cloud_image>
    <created_at>2010/04/15 04:23:36 +0000</created_at>
    <actions></actions>
    <links>
      <link rel="self" href="/api/server_template_multi_cloud_images/1"/>
      <link rel="server_template" href="/api/server_templates/2"/>
      <link rel="multi_cloud_image" href="/api/multi_cloud_images/7099"/>
    </links>
    <is_default>true</is_default>
    <updated_at>2010/04/15 04:23:36 +0000</updated_at>
  </server_template_multi_cloud_image>
  <server_template_multi_cloud_image>
    <created_at>2010/04/15 04:23:36 +0000</created_at>
    <actions></actions>
    <links>
      <link rel="self" href="/api/server_template_multi_cloud_images/6"/>
      <link rel="server_template" href="/api/server_templates/13"/>
      <link rel="multi_cloud_image" href="/api/multi_cloud_images/7239"/>
    </links>
    <is_default>true</is_default>
    <updated_at>2010/04/15 04:23:36 +0000</updated_at>
  </server_template_multi_cloud_image>
. . .
  <server_template_multi_cloud_image>
    <created_at>2012/11/06 11:30:54 +0000</created_at>
    <actions></actions>
    <links>
      <link rel="self" href="/api/server_template_multi_cloud_images/560983001"/>
      <link rel="server_template" href="/api/server_templates/270338001"/>
      <link rel="multi_cloud_image" href="/api/multi_cloud_images/212121001"/>
    </links>
    <is_default>true</is_default>
    <updated_at>2012/11/06 11:30:54 +0000</updated_at>
  </server_template_multi_cloud_image>
</server_template_multi_cloud_images>

 

 

 

PowerShell

Prerequisite:  Example assumes you have previously authenticated and your session cookie for subsequent requests is in 'cookieContainer'.

Example Call

#get cookie container from authentication $cookieContainer

$webRequest = [System.Net.WebRequest]::Create("https://my.rightscale.com/api/server_template_multi_cloud_images.xml")
$webRequest.Method = "GET"
$webRequest.CookieContainer = $cookieContainer
$webRequest.Headers.Add("X_API_VERSION", "1.5");

[System.Net.WebResponse] $webResponse = $webRequest.GetResponse()
$responseStream = $webResponse.GetResponseStream()
$responseStreamReader = New-Object System.IO.StreamReader -argumentList $responseStream
[string]$responseString = $responseStreamReader.ReadToEnd()
$responseString

Sample Output

Same as bash/curl output

You must to post a comment.
Last modified
10:19, 11 Oct 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.