Skip to content

Templates

Templates as opposed to Images are created by the user and are private.

They allow images to be created from servers already in use by preserving:

  • Users and their Passwords.
  • Installed software
  • Every file on the system.

They are not retained, however:

  • The network interfaces.
  • The associated ip and macaddress

Creating a Template

The following request is available to create a new template:

HTTP request

POST /ecs/v2/templates
{
  "server": "ec000001" 
  "description": "il mio primo template"
}

HTTP Response

{
  "status": "ok",
  "action_id": 700,
  "template": {
    "id": 2,
    "name": "ei000001",
    "creation_date": "2019-04-18T12:34:08+00:00",
    "active_flag": false,
    "status": "CG",
    "uuid": "6708cdc4-0c8d-4ccf-83c7-ae39bccaeb42",
    "description": "il mio primo template",
    "notes": "",
    "public": false,
    "cloud_image": false,
    "so_base": "debian",
    "api_version": "v4",
    "version": ""
  }
}

You may receive the following errors:

Status Code Message Explanation
400 server not found It is impossible to find the server from which you want to create a template, make sure the server exists and is in a proper state
400 Template can't be created for v1 server It is impossible to create template from v1 server
400 Template can't be created for ECSGPU8 plan ECSGPU8 plan does not support templates

View all Templates

To view all templates, the following request is available:

HTTP Request

GET /ecs/v2/templates

HTTP Response

{
  "status": "ok",
  "templates": [
    {
      "id": 2,
      "name": "ei000002",
      "creation_date": "2019-04-19T12:34:08+00:00",
      "active_flag": true,
      "status": "CD",
      "uuid": "6708cdc4-0c8d-4ccf-83c7-ae39bccaeb42",
      "description": "il mio secondo template",
      "notes": "",
      "public": false,
      "cloud_image": false,
      "so_base": "debian",
      "api_version": "v4",
      "version": ""
    },
    {
      "id": 1,
      "name": "ei000001",
      "creation_date": "2019-04-18T12:34:08+00:00",
      "active_flag": true,
      "status": "CD",
      "uuid": "8520asd5-1k6l-6hjq-67g9-rf46rfvbgt97",
      "description": "il mio primo template",
      "notes": "",
      "public": false,
      "cloud_image": false,
      "so_base": "centos",
      "api_version": "v4",
      "version": ""
    },
    ...
  ]
}

Viewing a specific Template

To view a specific Template, the following request is available:

HTTP Request

GET /ecs/v2/templates/{templatename}

HTTP Response

{
  "status": "ok",
  "template": {
    "id": 2,
    "name": "ei000002",
    "creation_date": "2019-04-19T12:34:08+00:00",
    "active_flag": true,
    "status": "CD",
    "uuid": "6708cdc4-0c8d-4ccf-83c7-ae39bccaeb42",
    "description": "il mio secondo template",
    "notes": "",
    "public": false,
    "cloud_image": false,
    "so_base": "debian",
    "api_version": "v4",
    "version": ""
  }
}

Renaming a Template

To rename a Template you can perform the following request:

HTTP Request

PUT /ecs/v2/templates/{templatename}
{
  "description": "il mio nuovo nome"
}

HTTP Response

{
  "status": "ok",
  "template": {
    "id": 2,
    "name": "ei000002",
    "creation_date": "2019-04-19T12:34:08+00:00",
    "active_flag": true,
    "status": "CD",
    "uuid": "6708cdc4-0c8d-4ccf-83c7-ae39bccaeb42",
    "description": "il mio nuovo nome",
    "notes": "",
    "public": false,
    "cloud_image": false,
    "so_base": "debian",
    "api_version": "v4",
    "version": ""
  }
}

Remove a Template

You can use the following request to remove a template:

HTTP request

DELETE /ecs/v2/templates/{templatename}

HTTP Response

{
  "status": "ok",
  "action": {
    "id": 709,
    "status": "in-progress",
    "user": "foo",
    "created_at": "2024-10-19T15:08:55.887799+00:00",
    "started_at": "2024-10-19T15:08:55.887284+00:00",
    "completed_at": "2024-10-19T15:09:56.067592+00:00",
    "resource": "ei000001",
    "resource_type": "DI",
    "type": "delete_template",
    "progress": 10
  }
}

!!! warning “Warning” Once a template is removed any data within it will be irretrievably deleted