Hi,
I'm trying to create an order (anonymous and not anonymous) through API but I ended up in both case with error 400
{message: Bad Request: The user_id/user_data field is required, messages: [The user_id/user_data field is required], status: 400}
Here an example of my call for anonymous order:
http.Client() .post("https://*****/api/orders/", headers: {'authorization': 'Basic ' + base64Encode(utf8.encode('****@gmail.com:*****'))}, body: json.encode({ "user_id": "0", "payment_id": "6", "shipping_id": "6", "products": { "1": {"product_id": "4585", "amount": "1"}, }, "user_data": {"email": "guest@example.com", "firstname": "Guest", "lastname": "Guest", "s_firstname": "Guest", "s_lastname": "Guest", "s_country": "US", "s_city": "Boston", "s_state": "MA", "s_zipcode": "02125", "s_address": "44 Main street", "b_firstname": "Guest", "b_lastname": "Guest", "b_country": "US", "b_city": "Boston", "b_state": "MA", "b_zipcode": "02125", "b_address": "44 Main street"} })) .then((response) => response.body) .then(json.decode) .then((json) => print(json)) .catchError((error, stackTrace) { print("inner: $error"); });
As you can see I filled both user_id and user_data but I'm still getting the same error. Any suggestions please?