Response code 200, no changes being made #8898
-
I am using requests from Python to run my API requests. API request looks like this: editpayload = {'serial': '1234'}
def get_edit(hostname, editpayload, headers, verbose, nbid):
edit = requests.patch(
url = f'https://url.com/api/dcim/devices/{nbid}',
headers=headers, timeout=60, verify=False, data=json.dumps(editpayload))
editstatus = edit.status_code
request = get_edit(hostname, editpayload, headers, verbose, nbid) Any ideas what I could be doing wrong here? Not sure why I get a response code of 200, but nothing on Netbox has actually changed. The request is there in the device log, but no change to the serial has happened. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Does it change if you add the missing ending slash in the URL? Also, to ensure correct content-type headers, you can use |
Beta Was this translation helpful? Give feedback.
Does it change if you add the missing ending slash in the URL?
Also, to ensure correct content-type headers, you can use
json=editpayload
instead of converting to JSON yourself.