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 services and other Docker-related resources. Specifically, for the Service resource with the Get Many operation, it retrieves a list of Docker Swarm services from a specified environment (endpoint) managed by Portainer.

Typical use cases include:

  • Automating the retrieval of all running or configured services in a Docker Swarm cluster.
  • Monitoring or auditing services across multiple environments.
  • Feeding service data into workflows for further processing, reporting, or alerting.

For example, you might use this node to fetch all services in your production environment to check their status or to trigger updates based on service configurations.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the Docker Swarm services are located.

Note: For this operation, only the environmentId property is required as input.

Output

The node outputs JSON data representing the list of Docker Swarm services retrieved from the specified environment. Each item in the output array corresponds to a service object as returned by the Portainer API, typically including details such as service ID, name, image, replicas, ports, and other configuration metadata.

No binary data output is produced by this operation.

Dependencies

  • Requires an active connection to a Portainer instance with API access.
  • Requires an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The node uses the base URL and API key from the credentials to make HTTP GET requests to the /endpoints/{environmentId}/docker/services endpoint.

Troubleshooting

  • Common issues:

    • Invalid or missing environmentId: Ensure the environment ID corresponds to a valid Portainer endpoint.
    • Authentication errors: Verify that the API key credential is correctly set up and has sufficient permissions.
    • Network connectivity: Confirm that n8n can reach the Portainer API URL.
  • Error messages:

    • 401 Unauthorized: Indicates invalid or missing API key. Check credentials.
    • 404 Not Found: The specified environment ID does not exist or is inaccessible.
    • 500 Internal Server Error: Possible server-side issue; retry later or check Portainer logs.

Resolving these usually involves verifying credentials, environment IDs, and network access.

Links and References

Discussion