Skip to content Skip to sidebar Skip to footer

Python/json - Does Order Matter And Why Is This Json Post To A Rest Api Failing?

I'm posting to the office 365 rest API and am creating the dump as per below: def CreateEvent(auth, cal_id, subject, start_time, end_time, attendees, content): create_url = 'h

Solution 1:

At a glance, I believe you just need to change

response = requests.post(create_url,data,headers=headers,auth=auth)

to

response = requests.post(create_url,content_data,headers=headers,auth=auth)

You were correct in calling the json.dumps() method to serialize the dictionary. Just pass that string to the server instead.

Post a Comment for "Python/json - Does Order Matter And Why Is This Json Post To A Rest Api Failing?"