NetBox icon

NetBox

Consume NetBox API

Overview

This node integrates with the NetBox API, specifically allowing users to update a Device Bay resource within the DCIM domain. A Device Bay in NetBox represents a physical bay in a device chassis where other devices or modules can be installed.

Typical use cases include:

  • Updating metadata about a device bay such as its name, label, or description.
  • Changing the parent device associated with the bay.
  • Installing or removing a device from the bay by updating the installed device ID.
  • Managing tags and custom fields for better organization and filtering.

For example, you might use this node to rename a device bay after hardware changes or to assign a newly installed module to a specific bay in your inventory system.

Properties

Name Meaning
Domain The NetBox API domain to target. Options: DCIM, IPAM, Tenancy, Extras, Virtualization, Circuits, Core, Users, Plugins, VPN, Wireless, Status. For this operation, must be "DCIM".
Device Bay ID Numeric ID of the device bay to update.
Update Fields Collection of fields to update on the device bay:
- Device ID Numeric ID of the parent device that contains this bay.
- Name Name of the device bay.
- Label Physical label of the device bay.
- Description Text description of the device bay.
- Installed Device ID Numeric ID of the device installed in this bay.
- Tags Comma-separated list of tag IDs to associate with the device bay.
- Custom Fields JSON string representing custom fields for the device bay.

Output

The node outputs an array containing one item per input, each with a json property holding the response from the NetBox API after the update operation. This typically includes the updated device bay object with all its properties reflecting the changes made.

No binary data output is produced by this node.

Example output structure (simplified):

{
  "id": 123,
  "device": 45,
  "name": "Bay A",
  "label": "Slot 1",
  "description": "Updated description",
  "installed_device": 67,
  "tags": ["tag1", "tag2"],
  "custom_fields": { "field1": "value1" }
}

Dependencies

  • Requires an active connection to a NetBox instance via its REST API.
  • Needs an API authentication token or key configured in n8n credentials to authorize requests.
  • The node depends on internal helper functions to execute the API operations but does not require external npm packages beyond those bundled.

Troubleshooting

  • Common issues:

    • Invalid or missing Device Bay ID will cause the update to fail.
    • Incorrect domain selection (must be "dcim" for Device Bays) will result in no matching resource.
    • Malformed JSON in custom fields may cause API errors.
    • Insufficient permissions or invalid API token will lead to authorization errors.
  • Error messages:

    • "ERROR in node execution:" followed by the error message indicates failure during the API call.
    • If "Continue on Fail" is enabled, errors are returned as part of the output JSON under an error field.
  • Resolutions:

    • Verify the Device Bay ID exists in NetBox.
    • Ensure the domain is set to "dcim".
    • Validate JSON syntax for custom fields before submitting.
    • Confirm API credentials have write permissions for the targeted resource.

Links and References

Discussion