NetBox icon

NetBox

Consume NetBox API

Overview

This node interacts with the NetBox API to update device records within the "DCIM" domain. It allows users to modify various attributes of a device such as its name, type, site, status, role, tenant, platform, serial number, location, rack position, IP addresses, cluster membership, virtual chassis details, comments, tags, and custom fields.

Typical use cases include:

  • Updating device inventory information after hardware changes.
  • Changing device status (e.g., marking a device as decommissioned or offline).
  • Assigning devices to different sites, racks, or tenants.
  • Adding or modifying metadata like tags, comments, or custom fields for better organization.

For example, a network administrator could use this node to update the serial number and status of a device after a hardware replacement, or to assign a device to a new rack position.

Properties

Name Meaning
Domain The NetBox API domain to target; here it is fixed to "DCIM" for device management.
Device ID The unique identifier of the device to update.
Update Fields A collection of fields to update on the device record:
- Name New name of the device.
- Device Type ID Identifier of the device type.
- Site ID Identifier of the site where the device is located.
- Status Status of the device; options include Active, Decommissioning, Offline, Planned, Failed, Inventory, Staged.
- Role ID Identifier of the device role.
- Tenant ID Identifier of the tenant associated with the device.
- Platform ID Identifier of the platform.
- Serial Number Serial number of the device.
- Asset Tag Asset tag assigned to the device.
- Location ID Identifier of the physical location.
- Rack ID Identifier of the rack containing the device.
- Position Numeric position of the device in the rack.
- Face Mounting face of the device; options are Front or Rear.
- Primary IPv4 ID Identifier of the primary IPv4 address.
- Primary IPv6 ID Identifier of the primary IPv6 address.
- Cluster ID Identifier of the cluster the device belongs to.
- Virtual Chassis ID Identifier of the virtual chassis.
- VC Position Position in the virtual chassis.
- VC Priority Priority in the virtual chassis.
- Comments Free text comments about the device.
- Tags Comma-separated list of tags for categorization.
- Custom Fields JSON object representing custom fields for the device.

Output

The node outputs a JSON object representing the updated device record as returned by the NetBox API. This typically includes all the device's properties after the update operation.

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

The node does not output binary data.

Dependencies

  • Requires access to a NetBox instance with the appropriate API endpoint.
  • Requires an API authentication token credential configured in n8n to authorize requests to the NetBox API.
  • The node depends on an internal helper function (executeOperation) to perform the actual API call.

Troubleshooting

  • Common issues:

    • Invalid or missing Device ID will cause the update to fail.
    • Insufficient permissions or invalid API token may result in authorization errors.
    • Providing invalid values for fields (e.g., non-existent site or device type IDs) can cause API errors.
    • Network connectivity issues to the NetBox server will prevent successful updates.
  • Error messages:

    • Errors from the NetBox API will be logged and, if "Continue on Fail" is enabled, returned in the output under an error key.
    • Typical error messages include "Not Found" for invalid IDs, "Unauthorized" for authentication failures, or validation errors for incorrect field values.
  • Resolution tips:

    • Verify that the Device ID exists in NetBox.
    • Ensure the API token has sufficient permissions to update devices.
    • Double-check all field values for correctness and existence in NetBox.
    • Confirm network connectivity and correct API URL configuration.

Links and References

Discussion