NetBox icon

NetBox

Consume NetBox API

Overview

This node interacts with the NetBox API, a popular infrastructure resource modeling tool. Specifically, for the Device Bay resource and the Delete operation, it allows users to delete a device bay record from the NetBox system by specifying its unique identifier.

Common scenarios where this node is beneficial include:

  • Automating cleanup of device bays that are no longer in use.
  • Integrating with workflows that manage physical device inventory, ensuring obsolete or decommissioned bays are removed automatically.
  • Synchronizing external systems with NetBox by programmatically deleting device bays based on external triggers.

Example: Automatically deleting a device bay after a device removal process completes, keeping the NetBox database clean and up-to-date.

Properties

Name Meaning
Domain The domain of the NetBox API to target. Options include: DCIM, IPAM, Tenancy, Extras, Virtualization, Circuits, Core, Users, Plugins, VPN, Wireless, Status. For Device Bay deletion, typically "DCIM" is used.
Device Bay ID The numeric ID of the device bay to delete. This uniquely identifies the device bay record within the selected domain and resource. It is required for the delete operation.

Output

The node outputs JSON data representing the result of the delete operation. Typically, a successful delete operation returns an empty response or confirmation status from the NetBox API. If an error occurs, the output JSON will contain an error field with the error message.

No binary data output is involved in this operation.

Dependencies

  • Requires access to a NetBox instance with appropriate API permissions.
  • Needs an API authentication token credential configured in n8n to authenticate requests to the NetBox API.
  • The node depends on internal helper functions (from ./helpers/executeOperation) to perform the actual API call.

Troubleshooting

  • Common issues:

    • Invalid or missing Device Bay ID: Ensure the ID provided corresponds to an existing device bay.
    • Insufficient API permissions: The API token must have delete rights on the device bays resource.
    • Incorrect domain selection: The domain should be set to "DCIM" when working with device bays.
    • Network connectivity issues to the NetBox server.
  • Error messages:

    • Errors returned from the NetBox API will be passed through and can appear as messages like "Not Found" if the device bay ID does not exist.
    • Authentication errors if the API token is invalid or expired.
  • Resolution:

    • Verify the device bay ID exists in NetBox.
    • Check API credentials and permissions.
    • Confirm network connectivity and correct domain/resource settings.
    • Enable "Continue on Fail" in the node settings to handle errors gracefully in workflows.

Links and References

Discussion