API patching custom fields

768 views
Skip to first unread message

Jay Wallace

unread,
Mar 22, 2021, 10:38:35 PM3/22/21
to NetBox
I am patching a custom field via API.  my patch returns a 200 and the complete data for the device but the custom filed has not been changed.

This is my data I am Patching with:

   "custom_fields": {
       "prtg_id": "4746"
   }

This is the custom fields section of the reply:

    "custom_fields": {
        "End of Warranty": null,
        "last_audit": "2021-03-22",
        "prtg_id": "",
        "Purchase Date": null,
        "Purchase Order": ""
    },


Any suggestion would be very helpful.

Thanks
j

Jay Wallace

unread,
Mar 22, 2021, 10:41:37 PM3/22/21
to NetBox
Here is the entire curl request:

curl --location --request PATCH 'http://netbox.mydomain.org/api/dcim/devices/236/' \
--header 'Accept: application/json' \
--header 'Authorization: Token <<my token>>' \
--header 'Content-Type: text/plain' \
--data-raw '{ 
   "custom_fields": {
       "prtg_id": "4746"
   }
} '

Jay Wallace

unread,
Mar 22, 2021, 10:57:26 PM3/22/21
to NetBox
I resolved the issue.

it needed to be https.

j
Reply all
Reply to author
Forward
0 new messages