Unable To Update Delivered Status In Shopify Through Rest API

Hi,

New order once we created in our in house order management system, when in-transit we used to call the following API methods :

  1. Get orders : /admin/api/2023-04/orders/{orderid}/fulfillment_orders.json
  1. Created fulfillment using the following URL : /admin/api/2023-04/fulfillments.json

request data :

{
“fulfillment”: {
“line_items_by_fulfillment_order”: [
{
“fulfillment_order_id”: ,
“fulfillment_order_line_items”:
}
],
“id”: ,
“location_id”:{location_id},
“tracking_info”: {
“number”: {tracking number},
“url”: {TrackingURL},
“company”: {company name}
},
“notify_customer”: true,
“message”: “”,
“origin_address”: “”
},
“order_id”: {OrderId},
“status”: “In-Transit”
}
3) Created fullfillment Event using the following URL : /admin/api/2023-04/orders/{OrderID}/fulfillments/{fulfillmentOrderID}/events.json

request data :

{
“fulfillment_events”: {
“Event”: {
FulfillmentId = {fulfillmentOrderID},
OrderId = {OrderID},
status = “In-Transit”
}
}

the above three steps created fulfillment and fulfillment status updated in-transit in shopify.

After that, when we try to update delivered status using the following URL unable to update.

  1. Created fullfillment Event using the following URL : /admin/api/2023-04/orders/{OrderID}/fulfillments/{fulfillmentOrderID}/events.json

request data :

{
“fulfillment_events”: {
“Event”: {
FulfillmentId = ,
OrderId = ,
status = “Delivered”
}
}

If I use status as Delivered in step-3, it will update delivered status in shopify. But unabler to update first in-transit status then delivered status. what I missed here. how to update Delivered status in shopify through rest API?

Thanks

Hey @Y3Tech

Are you getting a response from the API? I note in your example code the status value is ‘In-Transit’, this will throw an error, try ‘in_transit’ instead.

Hi @SBD , It was typo mistake. we used status value is “in_transit” only. if we updated one order status in_transit or delivered - successfully updated. the problem is, once create fulfillment and create fulfillment event for in_transit, after some time, when we try to update status from in_transit to delivered - got error ( “errors”: “Not Found”) and unable to change status from in_transit to delivered.

Can you please capture the request ID from the respond headers when you get the ‘Not Found’ error?

Hi @SBD

Request-ID is 70c0ff23-55e7-463b-8739-83ab1ebc5451

Thanks, DMing you.

Hi @SBD_

I reply to you with some queries in DM.

Thanks

Hi @SBD

Thank you for your help. As per your advice, I followed these steps

  1. Looked at fulfillment_orders to get fulfillment_order ID (GET /admin/api/2023-04/orders/{order_id}/fulfillment_orders.json)

  2. Created fulfillment using ID from step 1 (POST /admin/api/2023-04/fulfillments.json)

  3. Got fulfillment ID (GET /admin/api/2023-04/orders/{order_id}/fulfillments.json)

  4. Created in_transit event (POST /admin/api/2023-04/orders/{order_id}/fulfillments/{fulfillment_id}/events.json)

  5. Created delivered event (POST /admin/api/2023-04/orders/{order_id}/fulfillments/{fulfillment_id}/events.json)

Now My problem Solved. Thanks.

How did you mange this? As soon as we send in the initial fulfilment Shopify closes the fulfilment and rebuffs any further event or fulfilment messages with a “fulfilment closed” message and doesn’t alter the state nor update the customer