Developer forum

Forum » Ecommerce - Standard features » DW API Orderlines not merged

DW API Orderlines not merged

Mikkel Belchuke
Mikkel Belchuke
Reply

Hi. 

We use the web api to create orders from a mobile applikation. When we try to add the same product twice, to the shopping cart, it creates two orderlines instead of combining them.

POST:
/dwapi/ecommerce/carts/{SECRET}/items
 

{
    "ProductId":"{PRODUCTID}",
    "Quantity":"{QUANTITY}"
}
 
We only post a product id and a quantity, so there is no additional information (which would be the reason for the newly created orderline).
 

Replies

 
Nicolai Pedersen
Reply

But would that not be a PATCH on that orderline and not a POST = Create?

To keep the api clean - doing a POST and actually do a PATCH would be kind of a bug.

But maybe as an additional parameter merge=true to explicitly control that?

BR Nicolai

 
Mikkel Belchuke
Mikkel Belchuke
Reply

Hi Nicolai.

In theory, I don't know if an orderline (with the same data) exist, so I would expect the request to be a POST and not a PATCH. 

I can't come up with a scenario where you wouldn't want to merge your orderlines. Of cause if the data is different, but shouldn't the api could figure that out by itself? 

 

You must be logged in to post in the forum