API for updating the delivery status of an order.

API for updating the delivery status of an order.

Krishna111
Shopify Partner
3 0 1

How to update the order status(delivery Status) using Rest API's ? 

When a seller is using a third party fulfillment service and is integrated w9th shopify using rest API , how to update the order status to shopify using API.

Replies 3 (3)

Liam
Community Manager
3108 341 881

Hi Krishna111,

 

To update the delivery status of an order, you can use the Order and Fulfillment REST API in Shopify. Here's a step-by-step guide:

  1. Retrieve the Order : To get the order you want to update, you can use the Order API. The endpoint for this is GET /admin/api/2023-10/orders/{order_id}.json where {order_id} is the ID of the order.

  2. Create a Fulfillment for the Order : Once you have the order, you can create a fulfillment for that order. The fulfillment is the process of packaging and shipping an order to a customer. The endpoint for this is POST /admin/api/2023-10/orders/{order_id}/fulfillments.json where {order_id} is the ID the order. In the request body, you need to provide the necessary details like location_id, tracking_numbers etc. Here is an example of a request body:

{
  "fulfill": {
    "location_id": 905684977,
    "tracking_numbers": ["123456"],
    "notify_customer": true
  }
}
  1. Update the Fulfillment : If you want to update the fulfillment like updating the tracking information, you can use the Update Fulfillment API. The endpoint for this is PUT /admin/api/2023-10/orders/{order_id}/fulfillments/{fulfillment_id}.json where {order_id} is the ID of the order and {fulfillment_id} is the ID of the fulfillment. In the request body, you can provide the updated details like trackingnumber, trackingurls etc.

Remember to replace {order_id} and {fulfillment_id} with the actual IDs in your app. 

 

Please refer to the Shopify API documentation here for more details.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Krishna111
Shopify Partner
3 0 1

Hi Liam can you help me with the 2nd step what exactly to provide in the body?

 

javmah
Shopify Partner
3 0 0
I've been trying to use the Shopify Order Fulfillment API to mark an order as fulfilled using the following cURL command:

curl --location 'https: //book.myshopify.com/admin/api/2023-10/orders/5618584944961/fulfillments.json' \
--header 'X-Shopify-Access-Token: shpua_cb737100f23bb50cb93****' \
--header 'Content-Type: application/json' \
--data '{
    "fulfill": {
        "location_id": 82138267969321,
        "tracking_numbers": [
            "123456"
        ],
        "notify_customer": true
    }
}'
However, I'm encountering the following error response:
{
    "errors": {
        "fulfillment": "Required parameter missing or invalid"
    }
}
I have a fulfillment service configured, and the details can be found at "https://book.myshopify.com/admin/api/2023-10/fulfillment_services.json?scope=all":
{
    "fulfillment_services": [
        {
            "id": 64573309***,
            "name": "Snow City Warehouse",
            "email": null,
            "service_name": "Snow City Warehouse",
            "handle": "snow-city-warehouse",
            "fulfillment_orders_opt_in": true,
            "include_pending_stock": false,
            "provider_id": null,
            "location_id": 82138267969321,
            "callback_url": "https://mock.shop/",
            "tracking_support": false,
            "inventory_management": false,
            "admin_graphql_api_id": "gid://shopify/ApiFulfillmentService/64573309***",
            "permits_sku_sharing": true
        }
    ]
}