NetBox icon

NetBox

Consume NetBox API

Overview

This node integrates with the NetBox API to manage network infrastructure data. Specifically, for the "Virtual Device Context" resource and the "Create" operation, it allows users to create a new virtual device context within a specified device in the DCIM domain of NetBox. This is useful for network administrators who want to programmatically organize and manage virtual contexts associated with physical devices, such as segmenting device configurations or virtualizing device resources.

Practical examples include:

  • Automating the creation of virtual device contexts when provisioning new devices.
  • Organizing virtual contexts for multi-tenant environments.
  • Managing status and metadata of virtual device contexts via workflows.

Properties

Name Meaning
Domain The domain of the NetBox API to use; options include DCIM, IPAM, Tenancy, Extras, etc.
Virtual Device Context Name The name of the virtual device context to create (string).
Device ID The numeric ID of the device to which this virtual device context belongs (number).
Status The status of the virtual device context; options: Active, Planned, Offline.
Additional Fields A collection of optional additional fields:
- Identifier Numeric identifier (0-32767) for the virtual device context.
- Tenant ID ID of the tenant associated with the virtual device context.
- Primary IPv4 Address ID ID of the primary IPv4 address assigned to the context.
- Primary IPv6 Address ID ID of the primary IPv6 address assigned to the context.
- Description Text description of the virtual device context.
- Comments Additional comments about the virtual device context.
- Tags Comma-separated list of tag IDs to associate with the context.
- Custom Fields JSON string representing custom fields for the virtual device context.

Output

The node outputs an array containing one item per input item processed. Each output item includes a json property with the response from the NetBox API after creating the virtual device context. This typically contains details of the newly created virtual device context, including its ID and all submitted properties.

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

The node does not output binary data.

Dependencies

  • Requires access to a NetBox instance with API enabled.
  • Requires an API authentication token credential configured in n8n to authenticate requests to NetBox.
  • The node depends on internal helper functions (not fully shown here) to execute the API operation.

Troubleshooting

  • Common issues:
    • Invalid or missing API credentials will cause authentication failures.
    • Providing an invalid device ID or other IDs that do not exist in NetBox will result in API errors.
    • Improperly formatted custom fields JSON may cause request rejection.
  • Error messages:
    • Authentication errors: Check API token validity and permissions.
    • Validation errors from NetBox API: Verify all required fields are provided and valid.
    • Network errors: Ensure connectivity to the NetBox server.
  • Enabling "Continue on Fail" allows workflows to handle errors gracefully by returning error details in the output.

Links and References

Discussion