Portainer icon

Portainer

Interact with Portainer via API

Actions190

Templates → Template File

AI-generated

Overview

This node interacts with the Portainer API to retrieve a specific template file based on its identifier. It is useful in scenarios where users want to programmatically access and manage container templates stored in Portainer, such as automating deployment configurations or integrating template data into workflows.

For example, a user might use this node to fetch a Docker Compose template by its ID to dynamically generate deployment scripts or to audit template contents within an automation pipeline.

Properties

Name Meaning
Id The unique numeric identifier of the template to retrieve. This property is required to specify which template file the node should fetch.

Output

The node outputs JSON data representing the requested template file from Portainer. The structure typically includes details about the template content, metadata, and configuration as provided by the Portainer API.

If the template contains binary data (e.g., encoded files), it would be included in the output accordingly, but based on the code snippet, the primary output is JSON-formatted template information.

Dependencies

  • Requires an API key credential for authenticating with the Portainer API.
  • Needs the base URL of the Portainer instance configured in the node credentials.
  • Depends on the Portainer REST API being accessible and responsive.

Troubleshooting

  • Common issues:

    • Invalid or missing template ID will result in errors or empty responses.
    • Incorrect or expired API credentials will cause authentication failures.
    • Network connectivity problems to the Portainer server can prevent successful API calls.
  • Error messages:

    • Authentication errors typically indicate invalid API keys or misconfigured credentials.
    • "Template not found" errors suggest the provided template ID does not exist.
    • Timeout or connection errors imply network issues or incorrect base URL settings.

To resolve these, verify the template ID exists in Portainer, ensure API credentials are correct and have sufficient permissions, and confirm network connectivity to the Portainer server.

Links and References

Discussion