NetBox icon

NetBox

Consume NetBox API

Actions243

Device Role → Create

AI-generated

Overview

This node interacts with the NetBox API to create a new Device Role within the DCIM domain. It is useful for network administrators or IT professionals who want to automate the management of device roles in their network infrastructure. For example, it can be used to programmatically add new device roles with specific attributes such as name, color, description, and tags, streamlining the process of organizing and categorizing devices in NetBox.

Use Case Examples

  1. Creating a new device role named 'Core Router' with a red color code and a description for network documentation.
  2. Adding a device role for virtual machines with specific tags for easier filtering and management.

Properties

Name Meaning
Domain Specifies the domain of the NetBox API to interact with, here it is set to 'dcim' for device roles.
Name The name of the device role to be created.
Additional Fields Optional additional attributes for the device role such as slug, color, VM role flag, description, tags, and custom fields.

Output

JSON

  • id - Unique identifier of the created device role.
  • name - Name of the created device role.
  • slug - URL-friendly slug of the device role.
  • color - Color code associated with the device role.
  • vm_role - Indicates if the role applies to virtual machines.
  • description - Description of the device role.
  • tags - Tags associated with the device role.
  • custom_fields - Custom fields data for the device role.

Dependencies

  • NetBox API
  • An API key credential for authentication

Troubleshooting

  • Ensure the API key credential is correctly configured and has permissions to create device roles in NetBox.
  • Verify that the 'domain' is set to 'dcim' and the 'resource' is 'deviceRoles' for this operation.
  • Check that the 'Name' property is provided if required by the NetBox API to avoid validation errors.
  • If the node throws an error, enabling 'Continue on Fail' will output the error message as JSON instead of stopping execution.

Links

Discussion