Templates

Templates API

The Templates API provides endpoints to manage service templates in your PoloCloud instance.

Create, edit, and manage service templates for consistent deployments via REST API

List Templates

Retrieve all available templates from all services.

Endpoint: GET /polocloud/api/v3/templates/list

Response:

{
  "status": 200,
  "data": [
    {
      "name": "EVERY",
      "size": "unknown"
    },
    {
      "name": "EVERY_SERVER",
      "size": "unknown"
    },
    {
      "name": "EVERY_FALLBACK",
      "size": "unknown"
    },
    {
      "name": "lobby",
      "size": "unknown"
    },
    {
      "name": "minigame",
      "size": "unknown"
    },
    {
      "name": "proxy",
      "size": "unknown"
    }
  ]
}

Create Template

Create a new template for service deployment.

Endpoint: POST /polocloud/api/v3/template/

Request Body:

{
  "name": "my-custom-template"
}

Response:

{
  "status": 202,
  "message": "Creating template"
}

Error Responses:

  • 400 - Template name is required / Template already exists
  • 500 - Unsupported template runtime

Edit Template

Rename an existing template.

Endpoint: PATCH /polocloud/api/v3/template/{templateName}

Parameters:

  • templateName (path) - The name of the template to edit

Request Body:

{
  "name": "renamed-template"
}

Response:

{
  "status": 202,
  "message": "Template edited"
}

Error Responses:

  • 400 - Template name is required / Template could not be found
  • 500 - Unsupported template runtime

Delete Template

Delete an existing template.

Endpoint: DELETE /polocloud/api/v3/template/{templateName}

Parameters:

  • templateName (path) - The name of the template to delete

Response:

{
  "status": 204
}

Error Responses:

  • 400 - Template could not be found
  • 500 - Unsupported template runtime

Template Model

FieldTypeDescription
namestringUnique template name
sizestringTemplate size (usually "unknown" for local templates)

Template Types

Templates are categorized by their purpose and scope:

System Templates

  • EVERY - Applied to all services
  • EVERY_SERVER - Applied to all SERVER type services
  • EVERY_PROXY - Applied to all PROXY type services
  • EVERY_FALLBACK - Applied to fallback services

Custom Templates

  • lobby - Template for lobby services
  • minigame - Template for minigame services
  • proxy - Template for proxy services
  • Custom templates - User-defined templates for specific use cases

Usage Examples

List All Templates

curl -X GET "http://localhost:8080/polocloud/api/v3/templates/list" \
  -H "Cookie: token=YOUR_TOKEN_HERE"

Create New Template

curl -X POST "http://localhost:8080/polocloud/api/v3/template/" \
  -H "Content-Type: application/json" \
  -H "Cookie: token=YOUR_TOKEN_HERE" \
  -d '{
    "name": "my-custom-template"
  }'

Edit Template

curl -X PATCH "http://localhost:8080/polocloud/api/v3/template/my-custom-template" \
  -H "Content-Type: application/json" \
  -H "Cookie: token=YOUR_TOKEN_HERE" \
  -d '{
    "name": "renamed-template"
  }'

Delete Template

curl -X DELETE "http://localhost:8080/polocloud/api/v3/template/my-custom-template" \
  -H "Cookie: token=YOUR_TOKEN_HERE"