I figured it out. import json payload = { "name" : network["Name"], "subnet": network["Network"], "gatewayIp": gateway["GW"], "enabled":"true" } string=json.dumps(payload) It's a Python dictionary and json.dumps turns it into valid json for the body. The header works because it's an HTML field and not json.
... View more