Import a Template

post

/paas/api/v1.1/instancemgmt/{identityDomainId}/templates/cst/instances

Import a new cloud stack template file or update an existing template with a new file.

The values of the templateName and templateVersion attributes in the template file are used to uniquely identify a template in Oracle Cloud Stack. To update an existing template, edit the template file and modify the templateVersion attribute.

When you import a template with the same name as an existing template in this account, you create a new version of the template. Any existing stacks that were created from previous versions of this template are not affected.

Request

Supported Media Types
Path Parameters
Form Parameters
Back to Top

Response

Supported Media Types

201 Response

Created. The import was successful.
Body ()
Root Schema : viewtemplate-response
Type: object
The response body contains information about the template.
Show Source

400 Response

Bad Request. Returned if there is bad input.

500 Response

Server Error. Returned if a server error has occurred.
Back to Top

Examples

The following example shows how to import a template file from your local file system to Oracle Cloud Stack by submitting a POST request to the templates endpoint. The file is sent as a form parameter.

cURL Command

curl -i -X POST \
-u yourUsername:yourPassword \
-H "Content-Type:multipart/form-data" \
-H "X-ID-TENANT-NAME:MyIdentityDomain" \
-F "template=@MyTemplate.yaml" \
https://psm.us.oraclecloud.com/paas/api/v1.1/instancemgmt/MyIdentityDomain/templates/cst/instances

Note: This example uses the URL prefix for the United States. For information about the URL prefixes for other regions of the world, see Send Requests.

Example of Response Header

The following shows an example of the response header.

HTTP/1.1 201 Created
Date: Thu, 25 Aug 2016 18:16:50 GMT
Transfer-Encoding: chunked
Content-Type: application/json

Example of Response Body

The following shows an example of the response body in JSON format.

{
  "templateName":"MyTemplate",
  "latestVersion":"1.0.0",
  "description":"My first template",
  "createdOn":"2016-08-25T18:16:50.233+0000",
  "createdBy":"yourUsername",
  "state":"PUBLISHED",
  "type":"USER_TEMPLATE",
  "links":[
    {
      "rel":"canonical","href":"https://psm.us.oraclecloud.com/paas/api/v1.1/instancemgmt/MyIdentityDomain/templates/cst/instances/MyTemplate"
    },
    {
      "rel":"self","href":"https://psm.us.oraclecloud.com/paas/api/v1.1/instancemgmt/MyIdentityDomain/templates/cst/instances"
    }
  ]
}
Back to Top