TemplatesApi.md 6.7 KB

PortainerApi.TemplatesApi

All URIs are relative to http://portainer.domain/api

Method HTTP request Description
templateCreate POST /templates Create a new template
templateDelete DELETE /templates/{id} Remove a template
templateInspect GET /templates/{id} Inspect a template
templateList GET /templates List available templates
templateUpdate PUT /templates/{id} Update a template

templateCreate

Template templateCreate(body)

Create a new template

Create a new template. Access policy: administrator

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.TemplatesApi();

var body = new PortainerApi.TemplateCreateRequest(); // TemplateCreateRequest | Template details


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.templateCreate(body, callback);

Parameters

Name Type Description Notes
body TemplateCreateRequest Template details

Return type

Template

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

templateDelete

templateDelete(id)

Remove a template

Remove a template. Access policy: administrator

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.TemplatesApi();

var id = 56; // Number | Template identifier


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.templateDelete(id, callback);

Parameters

Name Type Description Notes
id Number Template identifier

Return type

null (empty response body)

Authorization

jwt

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

templateInspect

Template templateInspect(id)

Inspect a template

Retrieve details about a template. Access policy: administrator

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.TemplatesApi();

var id = 56; // Number | Template identifier


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.templateInspect(id, callback);

Parameters

Name Type Description Notes
id Number Template identifier

Return type

Template

Authorization

jwt

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

templateList

TemplateListResponse templateList()

List available templates

List available templates. Administrator templates will not be listed for non-administrator users. Access policy: restricted

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.TemplatesApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.templateList(callback);

Parameters

This endpoint does not need any parameter.

Return type

TemplateListResponse

Authorization

jwt

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

templateUpdate

templateUpdate(id, body)

Update a template

Update a template. Access policy: administrator

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.TemplatesApi();

var id = 56; // Number | Template identifier

var body = new PortainerApi.TemplateUpdateRequest(); // TemplateUpdateRequest | Template details


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.templateUpdate(id, body, callback);

Parameters

Name Type Description Notes
id Number Template identifier
body TemplateUpdateRequest Template details

Return type

null (empty response body)

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json