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
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.
#!/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
< 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
© 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.