Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker Swarm configs. Specifically, the Delete Config operation allows users to delete a Docker Swarm config resource identified by its ID within a specified environment (endpoint). This is useful for cleaning up unused or obsolete configuration data in Docker Swarm managed via Portainer.

Typical use cases include:

  • Automating cleanup of Docker Swarm configs that are no longer needed.
  • Managing lifecycle of configs as part of CI/CD pipelines.
  • Integrating Docker Swarm config management into broader automation workflows.

Example: Deleting a config with ID abc123def456 from environment ID 1 to ensure outdated configurations do not persist.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the Docker Swarm config resides.
Config ID The unique identifier of the Docker Swarm config to be deleted.
Force Delete Whether to force deletion even if the config is currently in use (boolean true/false).

Output

The node outputs the JSON response returned by the Portainer API after attempting to delete the config. Typically, this will be an empty object or confirmation message indicating successful deletion. If the deletion fails, the output may contain error details.

No binary data output is involved in this operation.

Dependencies

  • Requires a valid connection to a Portainer instance with API access.
  • An API key credential must be configured in n8n to authenticate requests to the Portainer API.
  • The node uses the base URL and API key from the configured credentials to send HTTP DELETE requests to the Portainer API endpoint corresponding to the config resource.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID or Config ID parameters will cause the request to fail.
    • Insufficient permissions or invalid API key can result in authorization errors.
    • Trying to delete a config that is currently in use without setting "Force Delete" may cause failure.
  • Error messages:

    • 404 Not Found: The specified config ID does not exist in the given environment.
    • 401 Unauthorized: API key is invalid or lacks required permissions.
    • 409 Conflict: The config is in use and cannot be deleted unless "Force Delete" is enabled.
  • Resolutions:

    • Verify that the Environment ID and Config ID are correct.
    • Ensure the API key has sufficient privileges to delete configs.
    • Use the "Force Delete" option cautiously to override usage restrictions.

Links and References

Discussion