Unable to update Custom Field via API #5836

Closed
opened 2025-12-29 19:33:21 +01:00 by adam · 3 comments
Owner

Originally created by @talha700 on GitHub (Dec 26, 2021).

NetBox version

v3.1.2

Python version

3.9

Steps to Reproduce

Trying to update the custom field via Netbox REST API using python requests

custom field of os_version (text) associated with devices

import requests


url = "https://<ip>/api/dcim/devices/10/"

token = "some_token"


device = {
  "name": "some-device",
  "device_type": 1,
  "device_role": 4,
  "site": 1,
  "custom_fields":{"os_version":"55"}
}

response = requests.patch(url,verify=False, headers={'Authorization': f'Token {token}'} ,
                data=device)
        
                
print(response.status_code)      

Expected Behavior

should update the custom field of os_version

Observed Behavior

return status code of 500

Originally created by @talha700 on GitHub (Dec 26, 2021). ### NetBox version v3.1.2 ### Python version 3.9 ### Steps to Reproduce Trying to update the custom field via Netbox REST API using python requests custom field of os_version (text) associated with devices ``` import requests url = "https://<ip>/api/dcim/devices/10/" token = "some_token" device = { "name": "some-device", "device_type": 1, "device_role": 4, "site": 1, "custom_fields":{"os_version":"55"} } response = requests.patch(url,verify=False, headers={'Authorization': f'Token {token}'} , data=device) print(response.status_code) ``` ### Expected Behavior should update the custom field of os_version ### Observed Behavior return status code of 500
adam added the type: bugstatus: revisions needed labels 2025-12-29 19:33:21 +01:00
adam closed this issue 2025-12-29 19:33:21 +01:00
Author
Owner

@DanSheps commented on GitHub (Dec 26, 2021):

The information provided is not sufficient to reproduce this issue. Please provide more detail on how you are reproducing this (Python API, Rest API, pynetbox, etc) and the exact steps to reproduce including what objects need to be created before attempting to recreate.

@DanSheps commented on GitHub (Dec 26, 2021): The information provided is not sufficient to reproduce this issue. Please provide more detail on how you are reproducing this (Python API, Rest API, pynetbox, etc) and the exact steps to reproduce including what objects need to be created before attempting to recreate.
Author
Owner

@talha700 commented on GitHub (Dec 26, 2021):

The information provided is not sufficient to reproduce this issue. Please provide more detail on how you are reproducing this (Python API, Rest API, pynetbox, etc) and the exact steps to reproduce including what objects need to be created before attempting to recreate.

I have updated the issue ,kindly have a look

@talha700 commented on GitHub (Dec 26, 2021): > The information provided is not sufficient to reproduce this issue. Please provide more detail on how you are reproducing this (Python API, Rest API, pynetbox, etc) and the exact steps to reproduce including what objects need to be created before attempting to recreate. I have updated the issue ,kindly have a look
Author
Owner

@talha700 commented on GitHub (Dec 26, 2021):

Solved it , I wasn't crafting my request correctly ,closing this.

@talha700 commented on GitHub (Dec 26, 2021): Solved it , I wasn't crafting my request correctly ,closing this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5836