NetBox icon

NetBox

Consume NetBox API

Overview

This node interacts with the NetBox API to update a Device Role within the DCIM domain. It allows users to modify attributes of an existing device role by specifying its ID and the fields to update. This is useful in network infrastructure management scenarios where device roles need to be maintained or adjusted, such as changing role names, colors, descriptions, or tagging for better organization.

Practical examples include:

  • Updating the color code of a device role to visually distinguish it in dashboards.
  • Changing the name or slug of a device role to reflect organizational changes.
  • Adding tags or custom fields to enhance metadata for device roles.

Properties

Name Meaning
Domain The domain of the NetBox API to use; for this operation, it must be "DCIM".
Device Role ID The unique identifier of the device role to update.
Update Fields Collection of fields to update on the device role:
- Name New name for the device role.
- Slug URL-friendly slug representing the device role.
- Color Hexadecimal color code (e.g., ff0000 for red) to assign to the device role.
- VM Role Boolean indicating if the role applies to virtual machines.
- Description Text description of the device role.
- Tags Comma-separated list of tags to associate with the device role.
- Custom Fields JSON object containing any custom fields to set on the device role.

Output

The node outputs a JSON object representing the updated device role record as returned by the NetBox API. This typically includes all standard device role properties reflecting the new state after the update.

If an error occurs and "Continue on Fail" is enabled, the output will contain a JSON object with an error field describing the issue.

No binary data output is produced by this node.

Dependencies

  • Requires access to a NetBox instance with appropriate API credentials.
  • The node expects an API key or token configured in n8n credentials to authenticate requests to the NetBox API.
  • Network connectivity to the NetBox server is necessary.

Troubleshooting

  • Common issues:

    • Invalid or missing Device Role ID will cause the update to fail.
    • Incorrect API credentials or insufficient permissions can result in authentication errors.
    • Providing invalid values for fields (e.g., malformed color codes) may cause validation errors from the API.
  • Error messages:

    • Errors thrown during execution are logged and, if "Continue on Fail" is enabled, returned as part of the output JSON under the error key.
    • Authentication failures typically indicate misconfigured API credentials.
    • Validation errors should be resolved by ensuring input fields conform to expected formats.

Links and References

Discussion