Developer forum

Forum » Development » Best practice create order using API

Best practice create order using API

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Any best practice code snippets for creating an order through the api?


Replies

 
Nicolai Pedersen
Reply

Hi Martin

Not in particaluar - you do not have much about your use case or context, but simply create an order instance and save it:

Order newOrder = new order(currency);
newOrder.ID = "Order1";
OrderService.Save(order);

Then call orderlineservice.Create() to add orderlines to the order.

BR Nicolai

 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Ok, thanks.
And there is not anything else that is "needed" in order for it to be a perfectly valid order in DW?

 
Nicolai Pedersen
Reply

There are a lot of scenarios related to this - is it a cart, an order, is it complete, has it been payed, is it recurring, does it have RMA etc. etc.

So yes, the above is an order object - but in what state, and what context?

BR Nicolai

 

You must be logged in to post in the forum