Previous Topic: template ObjectNext Topic: config_boundary Method (template Object)


rename Method (template Object)
Description

Rename an application template

Syntax
/api/v1/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/v1/template/rename?template=TWiki_r4&new_name=TWiki_r5&vdc=mygrid 
Sample Output
XML:
<opt></opt>
JSON:
{} 
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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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/v1/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.