Actions72
- Image Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Stack Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
Overview
This node integrates with the Portainer API to manage Docker Swarm nodes. Specifically, the Update operation for the Node resource allows users to update properties of a Docker Swarm node within a specified environment (endpoint). This is useful for managing node roles, availability, and labels programmatically via n8n workflows.
Typical use cases include:
- Changing the role of a node (e.g., from worker to manager).
- Updating node availability status (active, pause, drain).
- Modifying node metadata labels for scheduling or identification purposes.
Example: Automatically update node labels based on monitoring data or orchestrate node role changes during maintenance windows.
Properties
| Name | Meaning |
|---|---|
| Environment ID | The ID of the Portainer environment/endpoint where the Docker Swarm node resides. |
| Node ID | The unique identifier of the Docker Swarm node to be updated. |
| Version | The version number of the node object, required for concurrency control during the update. |
| Role | The desired role of the node in the swarm (e.g., manager or worker). |
| Availability | The availability state of the node (e.g., active, pause, drain). |
| Labels | JSON string representing key-value pairs to label the node for metadata or scheduling. |
Note: The last three properties (Role, Availability, Labels) are inferred from the update request body construction in the source code, although not explicitly listed in the provided input properties snippet. They are essential for the update operation.
Output
The node outputs the JSON response returned by the Portainer API after updating the node. This typically includes the updated node details such as its ID, version, role, availability, and labels.
No binary data output is involved.
Dependencies
- Requires an API key credential configured in n8n to authenticate requests against the Portainer API.
- The base URL of the Portainer API must be set in the credentials.
- The node sends HTTP POST requests to the Portainer API endpoint
/endpoints/{environmentId}/docker/nodes/{nodeId}/updatewith query parameterversionand a JSON body containing the update fields.
Troubleshooting
- Version Mismatch Error: If the version number provided does not match the current node version, the API may reject the update. Ensure you fetch the latest node version before updating.
- Invalid JSON in Labels: The
Labelsproperty expects a valid JSON string. Malformed JSON will cause errors. Validate JSON format before sending. - Authentication Errors: Verify that the API key credential is correctly configured and has sufficient permissions.
- Resource Not Found: Confirm that the
Environment IDandNode IDcorrespond to existing resources in Portainer. - Network Issues: Ensure that the n8n instance can reach the Portainer API endpoint URL.