create_order(url, product_id, qty) sending a POST with json={'product_id': ..., 'qty': ...} — the json= kwarg sets the Content-Type header and serializes for you (never pass a pre-dumped string to data= for JSON APIs). Return the new order's id from the response body.create_order(url, 42, 2)
the 'id' field of the created order
json= handles serialization and headers.
requests.post(url, json=payload).
raise_for_status before reading the body.