netbox-community / pynetbox

Python API client library for Netbox.
Apache License 2.0
538 stars 165 forks source link

500 Internal Server Error when creating custom field #561

Closed kprince28 closed 11 months ago

kprince28 commented 11 months ago

Hi team,

I am getting a 500 Internal Server Error when I try to create a custom field using the pynetbox library. The following code is failing:

import pynetbox

nb = pynetbox.api(url="https://mynetbox.example.com/", token="token1234567")
custom_field_data = [
    {
        "name": "Custom Field 1",
        "content_types": ["tenancy.contact"],
        "type": "text",
        "label": "Sample Custom field",
        "group_name": "Group",
        "description": "This is for test purpose",
        "required": False,
        "filter_logic": "exact",
        "ui_visibility": "read-write",
        "weight": 100,
    }
]
nb.extras.custom_fields.create(custom_field_data)

I have checked the NetBox logs and I can't see any errors that are related to the custom field creation. The NetBox database is up and running and there are no errors in the database. The NetBox settings are also correct.

I am not sure what is causing the 500 Internal Server Error. Could you please help me investigate this issue?

Thanks