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 > Publications > Import Publications

Import Publications

Table of Contents

Imports the given publication and its metadate to this account. When imported, the API call will return a <Location> header with the relative URI of the imported ServerTemplate. Only non-HEAD revisions that are shared with the account can be imported.

Table of Contents

Curl

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

Prerequisite: Example requires a publication ID for the asset that you wish to import. This publication ID can be found by using the API "List Publications" tutorial. The return data from the 'List Publications' API call will contain a 'links' section, which should contain a 'self' URI with the ID in it. For example, in the return data below, 177563 is the publication ID:

<links>
      <link rel="self" href="/api/publications/177563"/>
      <link rel="lineage" href="/api/publication_lineages/14092"/>
    </links>

Important! Do NOT attempt to import publication using the lineage ID as this will not work! Only importing by the publication ID is currently supported.

Example Call

#!/bin/sh -e
# Replace "PUBLICATION" variable below with publication ID (use "list publications" API call if needed to gather ID)
PUBLICATION="45"
curl -i -H X_API_VERSION:1.5 -b mycookie -X POST https://my.rightscale.com/api/publications/$PUBLICATIONS/import.xml

Sample Output

Note

  • Truncated XML output with limited headers included.
  • There is only one example listed in the output to save space.  
  • <Location> header returned shows relative URI to the imported ServerTemplate
 < HTTP/1.1 201 Created
HTTP/1.1 201 Created
* Server nginx/1.0.14 is not blacklisted
< Server: nginx/1.0.14
Server: nginx/1.0.14
< Date: Tue, 29 Oct 2013 21:05:52 GMT
Date: Tue, 29 Oct 2013 21:05:52 GMT
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Connection: keep-alive
Connection: keep-alive
< Status: 201 Created
Status: 201 Created
< X-Runtime: 28076
X-Runtime: 28076
< Set-Cookie:
Set-Cookie:
< Cache-Control: no-cache
Cache-Control: no-cache
< Location: /api/server_templates/324064001
Location: /api/server_templates/324064001
< X-Request-Uuid: af69d2a3d7a64146b31b6a2a8ba66326
X-Request-Uuid: af69d2a3d7a64146b31b6a2a8ba66326

You must to post a comment.
Last modified
13:39, 29 Oct 2013

Tags

This page has no custom 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.