Try our conversational search powered by Generative AI!

Episerver ServiceApi - Order - PUT

Vote:
 

Hi,

Is there any documentation on how the PUT action on "episerverapi/commerce/orders" is supposed to work?

For instance, how does the minimal model look to update a lineitem on a shipment?

I've tried with a couple of models but am still not able to split a shipment with one lineitem into two shipments.

Any guidance would be appreciated as I would really like to avoid writing an entire custom API for this...

Kind regards,

Mikael

#197360
Oct 01, 2018 15:44
Vote:
 

Hi Mikael

Have you seen this documentation: https://world.episerver.com/documentation/developer-guides/Episerver-Service-API/order-restful-operations/Purchase-orders/#Updateorder? Not sure if it will help answer your question.

David

#197379
Edited, Oct 01, 2018 23:53
Vote:
 

Yes, I have read the documentation multiple times but it doesnt make me any wiser. I always get a 204-response but no changes have been applied to my order and no errors logged in the log-file. So my question is how the request body should look like to split a shipment in two?

Ok, nevermind. Seems like my previous requests actually did modify the order - however the cache in CommerceManager was not released when updating yesterday but this issue seems to be resolved today.

It does seem a bit odd however that I need to include ALL information about the order in the request body when only splitting a shipment.

I can understand that the new shipment is missing shipping-address etc but the original shipment (id: 31) items should be persisted in my way of thinking, but perhaps this is by design?

Both billing address on the orderform and shipping address on the original shipment was cleared when posting putting a request body similar to this:

{
    "OrderForms": [
        {
            "Shipments": [
                {
                    "ShipmentId": 31,
                    "LineItems": [
                        {
                            "LineItemId": 35,
                            "Code": "ItemCode1",
                            "Quantity": 50,
                            "PlacedPrice": 99
                        }
                    ]
                },
                {
                    "LineItems": [
                        {
                            "Code": "ItemCode1",
                            "Quantity": 10,
                            "PlacedPrice": 99
                        }
                    ]
                }
            ],
            "OrderFormId": 22
        }
    ]
}

#197393
Edited, Oct 02, 2018 7:42
Vote:
 

PUT will overwrite the existing order, so if you split it in the posting model, and call PUT, the item will be updated

#197395
Oct 02, 2018 10:01
Vote:
 

So the short answer is that the calling system must send the complete order model to simply split a shipment as the order will be overwritten with each PUT request?

#197403
Oct 02, 2018 11:02
Vote:
 

Yes. That is what Put is for. You might be thinking about Patch, but that is not supported (yet)

#197405
Edited, Oct 02, 2018 11:31
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.