NetBox icon

NetBox

Consume NetBox API

Overview

This node interacts with the NetBox API, specifically targeting the "Device Role" resource within the "DCIM" domain when performing a "Get" operation. It retrieves detailed information about a specific device role by its unique identifier. This is useful in network infrastructure management scenarios where you need to fetch metadata or configuration details about device roles defined in NetBox.

Practical examples include:

  • Fetching a device role's attributes to display or use in automation workflows.
  • Validating device role existence before provisioning devices.
  • Integrating device role data into asset management or reporting systems.

Properties

Name Meaning
Domain The domain of the NetBox API to interact with. Options include: DCIM, IPAM, Tenancy, Extras, Virtualization, Circuits, Core, Users, Plugins, VPN, Wireless, Status. For this operation, it must be "DCIM".
Device Role ID The unique identifier (ID) of the device role record to retrieve from NetBox.

Output

The node outputs JSON data representing the device role object fetched from NetBox. This typically includes fields such as the device role's name, slug, color, description, and any other metadata defined by the NetBox API for device roles.

No binary data output is expected for this operation.

Example output structure (simplified):

{
  "id": 123,
  "name": "Core Router",
  "slug": "core-router",
  "color": "ff0000",
  "description": "Role for core routing devices"
}

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 call but no external npm packages beyond those bundled are required.

Troubleshooting

  • Common issues:

    • Invalid or missing Device Role ID will cause the API to return a not found error.
    • Incorrect domain selection (not "dcim") will prevent access to device roles.
    • Network connectivity or authentication failures will result in errors.
  • Error messages:

    • "404 Not Found": The specified device role ID does not exist. Verify the ID.
    • "401 Unauthorized" or "403 Forbidden": Authentication failed or insufficient permissions. Check API credentials.
    • "Invalid domain": Ensure the domain property is set to "dcim" for device roles.
  • Resolution tips:

    • Double-check the Device Role ID input.
    • Confirm API credentials and permissions.
    • Validate the domain and resource selections match the intended operation.

Links and References

Discussion