Previous Topic: srv ObjectNext Topic: app Object


template Object

Use this object to manage existing templates.

Method

Description

list

Retrieve list of application templates

info

Retrieve application template information

rename

Rename an application template

destroy

Destroy an application template

import

Import an application template

export

Export an application template

copy

Copy an application template

migrate

Migrate a template from a remote grid

config

Retrieve application template configuration parameters

config_boundary

Retrieve application template boundary

lock

Lock an application template

unlock

Unlock an application template

get_acl

Retrieve template ACL.

put_acl

Replace entire template ACL

modify_acl

Replace a portion of template ACL

list Method (template Object)
Description

Retrieve list of application templates

Syntax
/api/v2/template/list?vdc=controller-name 
Arguments
vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Retrieve list of application templates

GET http://192.168.123.200/api/v2/template/list?vdc=mygrid 
Sample Output
XML:
<templates> 
   template> 
      name>TWiki_r11</name> 
      description>TWiki 4.3.1 collaboration platform (v4.3.1-7)</description> 
      destroy_on_stop>0</destroy_on_stop> 
      doc_url>http://doc.3tera.net/AppLogic29/RefAppsTWiki4.html</doc_url> 
      id>2</id> 
      state>stopped</state> 
      template>0</template> 
      user1></user1> 
      user2></user2> 
   </template> 
   . 
   . 
   . 
</templates> 
JSON:
{ 
   "template" : [ 
      { 
         "template" : "0", 
         "user1" : "", 
         "name" : "TWiki_r11", 
         "description" : "TWiki 4.3.1 collaboration platform (v4.3.1-7)", 
         "state" : "stopped", 
         "doc_url" : "http://doc.3tera.net/AppLogic29/RefAppsTWiki4.html", 
         "destroy_on_stop" : "0", 
         "id" : "2", 
         "user2" : "" 
      }, 
      . 
      . 
      . 
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

info Method (template Object)
Description

Retrieve application template info

Syntax
 /api/v2/template/info?template=template&vdc=controller-name 
Arguments
template

Name of the application template

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Retrieve information for an application template named

VDS_CentOS51_r15. 
GET http://192.168.123.200/api/v2/template/info?template=VDS_CentOS51_r15&vdc=mygrid 
Sample Output
XML:
<template> 
<name>VDS_CentOS51_r15</name> 
<bw>1000000</bw> 
<cpu>0.25</cpu> 
<description>Virtual Dedicated Server - Based on CentOS 5.1 (v1.0.14-1)</description> 
<destroy_on_stop>0</destroy_on_stop> 
<dflt_appliance></dflt_appliance> 
<dflt_appliance_opts></dflt_appliance_opts> 
<doc_url>http://doc.3tera.net/AppLogic27/RefAppsVdsLinux.html</doc_url> 
<id>12</id> 
<incomplete>0</incomplete> 
<locked>0</locked> 
<mem>268435456</mem> 
<state>stopped</state> 
<template>0</template> 
<user1></user1> 
<user2></user2> 
</template>
JSON:
{ 
"locked" : "0", 
"template" : "0", 
"cpu" : "0.25", 
"user1" : "", 
"name" : "VDS_CentOS51_r15", 
"dflt_appliance" : "", 
"description" : "Virtual Dedicated Server - Based on CentOS 5.1 (v1.0.14-1)", 
"state" : "stopped", 
"bw" : "1000000", 
"incomplete" : "0", 
"doc_url" : "http://doc.3tera.net/AppLogic27/RefAppsVdsLinux.html", 
"dflt_appliance_opts" : "", 
"destroy_on_stop" : "0", 
"id" : "12", 
"mem" : "268435456", 
"user2" : "" 
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=template missing in the request.

404.1

Application VDS_CentOS_r1 does not exist. - Template specified in the request does not exist on the VDC.

rename Method (template Object)
Description

Rename an application template

Syntax
/api/v2/template/rename?template=template&new_name=new-template&vdc=controller-name 
Arguments
template

Name of the template to be renamed

new_name

New name of the template

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Rename a template named TWiki_r4 to TWiki_r5.

GET http://192.168.123.200/api/v2/template/rename?template=TWiki_r4&new_name=TWiki_r5&vdc=mygrid 
Sample Output
XML:
<message></message>
JSON:
{
   "message" :""
}
HTTP Error Codes
404

Entity vdc mygrid not found. - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=template missing in the request.

400.4

Missing required arguments (new_name). - Argument new_name=new-name missing in the request.

404.1

Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.

destroy Method (template Object)
Description

Destroy an application template

Syntax
/api/v2/template/destroy?template=application&vdc=controller-name 
Arguments
template

Name of the application template to be destroyed

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Destroy an application template named test.

GET http://192.168.123.200/api/v2/template/destroy?template=test&vdc=mygrid 
Sample Output
XML:
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
JSON:
{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
} 
HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=app missing in the request.

Note: To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer to the job object.

import Method (template Object)
Description

Import an application template.

Syntax
/api/v2/template/import?template=application&target=directory-or-file&vdc=controller-name
Arguments
template

Name of the application template

vdc

Name of the target Virtual Data Center

Transaction Type

asynchronous

Request Type

GET

Examples

Import application template named test

GET http://192.168.123.200/api/v2/template/import?template=test&vdc=mygrid 
Sample Output
XML
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>

JSON
{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
}

Note

All the output in JSON is UTF8 encoded. Use a UTF8 decode to decode the UTF8 encoded output.

The following is an example of a simple PHP script to decode UTF8 encoded JSON output:

<? 
$json = '{"a": "\u00e3\u0081\u0082" }'; 
$j = json_decode($json); 
echo utf8_decode($j->{'a'}); 
?>

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=app missing in the request.

Notes

To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer job object.

export Method (template Object)
Description

Export an application template.

Syntax
/api/v2/template/export?template=application&target=directory-or-file&vdc=controller-name
Arguments
template

Name of the application template

vdc

Name of the target Virtual Data Center

Transaction Type

asynchronous

Request Type

GET

Examples

Export application template named test

GET http://192.168.123.200/api/v2/template/export?template=test&vdc=mygrid 
Sample Output

XML

<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>


JSON

{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
}

Note

All the output in JSON is UTF8 encoded. Use a UTF8 decode to decode the UTF8 encoded output.

The following is an example of a simple PHP script to decode UTF8 encoded JSON output:

<? 
$json = '{"a": "\u00e3\u0081\u0082" }'; 
$j = json_decode($json); 
echo utf8_decode($j->{'a'}); 
?>

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=app missing in the request.

Notes

To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer job object.

copy Method (template Object)
Description

Copy an application template

Syntax
/api/v2/template/copy?template=application&new_name=new-application&vdc=controller-name 
Arguments
template

Name of the application template to be copied

new_name

Name of the new application template

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Copy an application template named test to test2.

GET http://192.168.123.200/api/v2/template/copy?template=test&new_name=test2&vdc=mygrid 
Sample Output
XML:
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
JSON:
{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
} 
HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=app missing in the request.

400.4

Missing required arguments (new_name). - Argument new=new-name missing in the request.

Note: To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer to the job object.

migrate Method (template Object)
Description

Migrate an application template from a remote grid

Syntax
/api/v2/template/migrate?grid=remote-grid&template=application&vdc=controller-name 
Arguments
grid

Controller IP or FQDN of a remote grid

template

Name of the application template to be migrated

vdc

Name of the target virtual data center

Options

See Application Control in the Command Line Shell Reference for descriptions of the options available for this command.

Note: The migrate method does not support SSH agent forwarding.

Transaction Type

asynchronous

Request Type

GET

Examples

Migrate an application template named test from remote-grid.mygrid.net.

GET http://192.168.123.200/api/v2/template/migrate?grid=remote-grid.mygrid.net&template=test&vdc=mygrid 
Sample Output
XML:
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
JSON:
{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
} 
HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=app missing in the request.

400.4

Missing required arguments (grid). - Argument grid=remote-grid missing in the request.

Note: To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer to the job object.

config Method (template Object)
Description

Retrieve application template configuration parameters

Syntax
/api/v2/template/config?template=template&vdc=controller-name 
Arguments
template

Name of the application template

vdc

Name of the target virtual data center

Options

See Application Control in the Command Line Shell Reference for descriptions of the options available for this command.

Note: The template object in the Web Services API relates to the application object of the shell.

Transaction Type

synchronous

Request Type

GET

Examples

Retrieve configuration parameters for template VDS_CentOS51_r15.

GET http://192.168.123.200/api/v2/template/config?template=VDS_CentOS51_r15&vdc=mygrid 
Sample Output
XML:
<config>
   <name>VDS_CentOS51_r15</name>
   <__description>Virtual Dedicated Server - Based on CentOS 5.1 (v1.0.14-1)</__description>
   <__doc_url>http://doc.3tera.net/AppLogic27/RefAppsVdsLinux.html</__doc_url> 
   <__template>0</__template>
</config>
JSON:
{
   "__doc_url" : "http://doc.3tera.net/AppLogic27/RefAppsVdsLinux.html",
   "__template" : "0",
   "__description" : "Virtual Dedicated Server - Based on CentOS 5.1 (v1.0.14-1)",
   "name" : "VDS_CentOS51_r15"
} 
HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=template missing in the request.

404.1

Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.

config_boundary Method (template Object)

Note: This method has been deprecated and is included here for compatibility with existing user scripts. New users should use the config command with the option flag &boundary.

Description

Retrieve application template boundary

Syntax
/api/v2/template/config_boundary?template=template&vdc=controller-name 
Arguments
template

Name of the application template

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Retrieve boundary for application template VDS_CentOS51_r15.

GET http://192.168.123.200/api/v2/template/config_boundary?template=VDS_CentOS51_r15&vdc=mygrid 

Sample Output

XML:
<boundary>
  <interface>
    <name>ext</name>
  </interface>
  <name>main</name>
  <properties>
    <property>
      <mandatory>1</mandatory>
      <name>mode</name>
      <type>string</type>
      <values>manual|format|fscopy|fsck|fsrepair</values>
    </property>
    <property>
      <dflt></dflt>
      <name>fs_type_src</name>
      <type>string</type>
      <values>ext2|ext3|ext4|fat16|fat32|reiserfs|swap|ext3-snapshot|iso9660|partitioned|ufssol|zfs|raw</values>
    </property>
    .
    .
    .
  </properties>
  <resources>
    <resource>
      <dflt>512M</dflt>
      <max>1024M</max>
      <min>160M</min>
      <name>mem</name>
    </resource>
    .
    .
    .
  </resources>
  <volume>
    <name>dst</name>
  </volume>
</boundary>
JSON:
{
   "resource" : [
      {
         "min" : "160M",
         "max" : "1024M",
         "name" : "mem",
         "dflt" : "512M"
      },
      {
         "min" : "1000K",
         "max" : "1000K",
         "name" : "bw",
         "dflt" : "1000K"
      }
   ],
   "volume" : {
      "name" : "dst"
   },
   "interface" : {
      "name" : "ext"
   },
   "name" : "main",
   "property" : [
      {
         "name" : "mode",
         "type" : "string",
         "values" : "manual|format|fscopy|fsck|fsrepair",
         "mandatory" : 1
      },
 
      {
         "name" : "adv_options",
         "type" : "string",
         "dflt" : ""
      }
   ]
}

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=template missing in the request.

404.1

Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.

lock Method (template Object)
Description

Lock an application template

Syntax
/api/v2/template/lock?template=template&pwd=password&vdc=controller-name 
Arguments
template

Name of the application template

pwd

Password

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Lock application template VDS_CentOS51_r15.

GET http://192.168.123.200/api/v2/template/lock?template=VDS_CentOS51_r15&pwd=password&vdc=mygrid 
Sample Output
XML:
<message></message>
JSON:
{
   "message" :""
}
HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=template missing in the request.

400.4

Missing required arguments (pwd). - Argument password=password missing in the request.

403.1

Permission Denied for ‘lock’ access on object ‘application’ with name ‘VDS_CentOS55_r5’.

404.1

Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.

Note: The password that is used to lock a template application is required to unlock the application. When a template application is locked, no volumes belonging to the application may be managed and the application cannot be modified in any way.

unlock Method (template Object)
Description

Unlock an application template

Syntax
/api/v2/template/unlock?template=template&pwd=password&vdc=controller-name 
Arguments
template

Name of the application template

pwd

Password

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Unlock application template VDS_CentOS51_r15.

GET http://192.168.123.200/api/v2/template/unlock?template=VDS_CentOS51_r15&pwd=password&vdc=mygrid 
Sample Output
XML:
<message></message>
JSON:
{
   "message" :""
}
HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template). - Argument template=template missing in the request.

400.4

Missing required arguments (pwd). - Argument password=password missing in the request.

403.1

Permission Denied for ‘lock’ access on object ‘application’ with name ‘VDS_CentOS55_r5’.

404.1

Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.

Note: If the application was locked with a password, the passwords must match. If the application was locked without a password, then only an administrator may unlock the application.

get_acl Method (template Object)
Description

Retrieve the template ACL, or portion of the template ACL which relates to a particular principal.

Syntax
/api/v2/template/get_acl?template=template&principal=<principal>&vdc=controller-name 
Arguments
template

Name of the template

principal

A URL-encoded principal

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Example: Retrieve application ACL

Retrieve application ACL for template VDS_CentOS.

GET http://192.168.123.200/api/v2/template/get_acl?template=VDS_CentOS&principal=&vdc=mygrid 
Sample Output
XML:

<acl>
  <entries>
    <entry>
      <configure>1</configure>
      <id>778fee4e-9b83-4160-8b79-8bb0e1a87af8</id>
    </entry>
  </entries>
  <owner>
    <id></id>
  </owner>
</acl>

JSON:

{
   "acl" : {
      "owner" : {
         "id" : ""
      },
      "entries" : [
         {
            "configure" : 1,
            "id" : "778fee4e-9b83-4160-8b79-8bb0e1a87af8"
         }
      ]
   }
}

Example: Display the ACL data for principal

Display the ACL data for principal local:user:api@3tera.com for template VDS_CentOS

GET http://192.168.123.200/api/v2/template/get_acl?template=VDS_CentOS&principal=local%3Auser%3Aapi%403tera.com&vdc=mygrid
Sample Output

XML:

<acl>
  <entries>
    <entry>
      <configure>1</configure>
      <id>778fee4e-9b83-4160-8b79-8bb0e1a87af8</id>
    </entry>
  </entries>
  <owner>
    <id></id>
  </owner>
</acl>

JSON:

{
   "acl" : {
      "owner" : {
         "id" : ""
      },
      "entries" : [
         {
            "configure" : 1,
            "id" : "778fee4e-9b83-4160-8b79-8bb0e1a87af8"
         }
      ]
   }
}

HTTP Error Codes
400

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template)

- Argument app=app missing

Missing required arguments (principal)

- Argument principal=principal missing

404.1

Entity not found - Application test does not exist.

- A template was specified that does not exist on mygrid.

Entity not found - Failed to retrieve application ACL - ACL does not contain principal local user 'test@3tera.com'.

- An invalid principal was specified

Note: This API is available with WS_API_r6-1.0.6-1 and above.

put_acl Method (template Object)
Description

Replace the entire template ACL.

Syntax
/api/v2/template/put_acl?template=template&owner=<owner>&acl=<ACLs>&vdc=controller-name 
Arguments
template

Name of the template

owner

A URL-encoded owner attribute of the grid ACL to the specified principal

acl

URL-encoded list of principals separated with a slash (/)

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Replace the entire ACL for template application VDS_CentOS with an owner api@3tera.com

GET
http://192.168.123.200/api/v2/template/put_acl?template=VDS_CentOS&owner=local%3Auser%3Aapi%403tera.com&acl=&vdc=mygrid

Replace the entire ACL for template application VDS_CentOS with an owner api@3tera.com and principal local:user:api@3tera.com=full


GET
http://192.168.123.200/api/v2/template/put_acl?template=VDS_CentOS&owner=local%3Auser%3Aapi%403tera.com&acl=local%3Auser%3Aapi%403tera.com%3Dfull&vdc=mygrid

Replace the entire ACL for template application VDS_CentOS with an owner api@3tera.com and principal local:user:api@3tera.com=full/local:user:test@3tera.com=configure.

GET
http://192.168.123.200/api/v2/template/put_acl?template=VDS_CentOS&owner=local%3Auser%3Aapi%403tera.com&acl=local%3Auser%3Aapi%403tera.com%3Dfull%2Flocal%3Auser%3Atest%403tera.com%3Dconfigure&vdc=mygrid
 
Sample Output

JSON

{
   "message" : ""
} 

XML


<message></message>

HTTP Error Codes
400

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template)

- Argument template=template missing

Missing required arguments (owner)

- Argument owner=owner

Missing required arguments (acl)

- Argument acl=acl missing

404.1

Entity not found - Application test does not exist.

- A template was specified that does not exist on mygrid.

Entity not found - Failed to put application ACL - invalid principal data - principal local user 'test@3tera.com' does not exist.

- An invalid owner or acl was specified

modify_acl Method (template Object)
Description

Replace that portion of the template ACL which relates to the owner or a principal.

Syntax
/api/v2/template/modify_acl?template=template&acl=<ACLs>&vdc=controller-name 
Arguments
template

Name of the template

acl

URL-encoded list of principals separated with a slash (/)

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Modify the ACL for template application VDS_CentOS by replacing the owner with api@3tera.com

GET
http://192.168.123.200/api/v2/template/modify_acl?template=VDS_CentOS&acl=local%3Auser%3Aapi%403tera.com%3Downer&vdc=mygrid

Modify the ACL for template application VDS_CentOS by replacing the owner api@3tera.com and principal local:user:api@3tera.com=full

GET
http://192.168.123.200/api/v2/template/modify_acl?template=VDS_CentOS&acl=local%3Auser%3Aapi%403tera.com%3Downer%2Flocal%3Auser%3Aapi%403tera.com%3Dfull&vdc=mygrid

Modify the ACL for template application VDS_CentOS by replacing the access levels for test@3tera.com and api@3tera.com and principal local:user:api@3tera.com=configure/local:user:test@3tera.com=read.

GET
http://192.168.123.200/api/v2/template/modify_acl?template=VDS_CentOS&acl=local%3Auser%3Aapi%403tera.com%3Dconfigure%2Flocal%3Auser%3Atest%403tera.com%3Dread&vdc=mygrid

HTTP Error Codes
400

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (template)

- Argument template=template missing

Missing required arguments (acl)

- Argument acl=acl missing

404.1

Entity not found - Template VDS_CentOS does not exist.

- An application template was specified that does not exist on mygrid.

Entity not found - Failed to put template ACL - invalid principal data - principal local user 'test@3tera.com' does not exist.

- An invalid owner or acl was specified

Sample Output
JSON:
{
   "message" : ""
} 
XML:
<message></message>

Note: This API is available with WS_API_r6-1.0.6-1 and above.