You can use the REST API content management service to import and export content, such as blueprints, between vRealize Automation systems.

Before you begin

  • Log in to vRealize Automation with an appropriate role. For example: Software Architect, Application Architect, Infrastructure Architecture or some combination of these depending on the need.

  • Verify that the host name and fully qualified domain name of the vRealize Automation instance are available.

  • Verify that there is a valid HTTP bearer token that matches your login credentials. See REST API Authentication.

About this task

vRealize Automation customers often experiment with system artifacts such as catalog items, XaaS services, resource actions, and IaaS blueprints in their development or staging environments. When appropriate, users need to move these artifacts to their production environments.

Note:

You cannot import/export approval policies or entitlements. Also, you cannot import or export any content that is in a draft state.

The examples herein are shown as Curl commands for consistency with other similar examples, though the REST API content management service provides a convenient mechanism for moving such artifacts between systems using the CloudClient interface. With CloudClient, there is no need to set heading values, including the Authorization header. The $host//$servicename/api is eliminated from the URL and the service name becomes a separate parameter. For example, consumer/entitled CatalogItems/{id}/request/template. See Using vRealize CloudClient.

Some parameters on the API request are common to all content management service import and export commands. These parameters are listed below.

Parameter

Description

$host

The host name and fully qualified domain name or IP address of the vRealize Automation identity server.

$token

A valid HTTP bearer token that includes necessary credentials.

Note:

When exporting content, values of secure strings and encrypted properties are excluded by default. You can add the --secure false parameter to commands to export these properties as plain text with your content. Secure strings and encrypted properties are typically used as property holders for passwords.

The following examples illustrate the types of requests that you might use in typical import export situations.

Procedure

  1. (Optional) : Use the REST API content service to display a list of supported vRealize Automation content types. Typically, this step is required only if you are not familiar with the content on your system or if you need to verify the content.

    A content type describes the content that you can import or export using the content management service.

    $curl --insecure -s -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$host/content-management-service/api/provider/contenttypes

  2. Display a list of available content in vRealize Automation.

    Content includes published artifacts such as blueprints, software, properties etc.

    $curl --insecure -s -H"Content-Type: application/json" -H "Authorization: Bearer $token" https://$host/content-management-service/api/contents

  3. If applicable, you can also apply filtering by content type.

    This example sets the contentTypeId to composite-blueprint.

    $curl --insecure -s -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$host/content-management-service/api/contents?%24filter=contentTypeId+eq+%27composite-blueprint%27

  4. Create a package that contains the desired content.

    The following command creates a package named Demo Package with a content ID of 9b348c29-88ff-4fa8-b93e-f80bc7c3e723.

    $curl --insecure -s -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$host/content-management-service/api/packages-d'{"name" : "Demo Package", "description" : "Package for demo purposes", "contents" : [ "9b348c29-88ff-4fa8-b93e-f80bc7c3e723" ]}'

  5. (Optional) : List the packages within the content service. Use this step if you need to confirm the contents of the package you created.

    $curl --insecure -s -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$host/content-management-service/api/packages

  6. Export the specified package as a .zip file.

    The example specifies the Accept header as application/zip and the output file as package.zip.

    $curl --insecure -s -H "Accept: application/zip"-H "Authorization: Bearer $token" https://$host/content-management-service/api/packages/54f627bb-2277-48af-9fa0-7d7366b498f3-o package.zip

  7. Validate the package prior to importing it.

    The example uses the 'DukesBankApp.zip' which is out-of-box content provided on the vRealize Automation virtual appliance. You can copy the file from /usr/lib/vcac/tools/initial-config/sample-oob-content/DukesBankApp.zip using WinSCP (Windows) or scp (Mac).

    $curl --insecure -s -H "Content-Type: multipart/form-data"-H "Authorization: Bearer $token" https://$host/content-management-service/api/packages/validate-F" file=@DukesBankApp.zip"

    The validation output shows the status of each content item within the package.

  8. Import the package.

    This example imports the DukesBankApp.zip package.

    $curl --insecure -s -H "Content-Type: multipart/form-data"-H "Authorization: Bearer $token" https://$host/content-management-service/api/packages-F" file=@DukesBankApp.zip"