Developer forum

Forum » Dynamicweb 10 » 400 "cartModel field is required" on /dwapi/ecommerce/carts/create

400 "cartModel field is required" on /dwapi/ecommerce/carts/create

Sigurd Nejrup
Reply

In DW9, this endpoint seemed to work fine out of the box:

/dwapi/ecommerce/carts/create

In DW10, the same endpoint returns a 400 code, telling me I need to include the cartModel field.

The swagger docs specifically says:

"nothing is mandatory aside from the currencyCode, countryCode and languageId as it can be updated through the PATCH endpoints."

But that does not seem to be the case. What is the cartModel field, and how do I give the field an appropiate value?


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Sigurd

Since you are doing a post, the body is required. So on your body tab in postman, do you post anything?

I think there might be a difference from 9 to 10 because of the change in .NET.

Try to post a body that is just an empty model:
{}

Would it be helpful to have a GET endpoint for create that does not take a body at all, but simply creates and empty cart?

BR Nicolai

Votes for this answer: 1
 
Sigurd Nejrup
Reply

Hi Nicolai, thanks for the swift response.
I was sending an empty body, yes. Sending a body with an empty model worked though, thank you!

 

You must be logged in to post in the forum