How to fulfill orders using REST API?

JianXiongWu
New Member
10 0 0

I need to fulfill orders using the REST API given the order_id. I started to retrieve the fulfillments associated with the order_id where order_id is 2185365291143

 

https://.../admin/api/2020-04/orders/2185365291143/fulfillments.json

I receive status code 200, and but the json body response is empty. I have verified that the order is unfullfilled.

{'fulfillments': []}

In the attached image, I have visualized what I really want to achieve (basically fulfill all the line items in an order)Capture.PNGCapture2.PNG

0 Likes
hassain
Shopify Staff (Retired)
Shopify Staff (Retired)
623 104 148

Hi @JianXiongWu ,

 

If you are using API version 2020-01 and higher, you can fulfill an order using the FulfillmentOrder and Fulfillment resources. Follow this document for more information on how to do this: https://shopify.dev/tutorials/manage-fulfillments-with-fulfillment-and-fulfillmentorder-resources 

 

If you are using API version 2019-10 and below, you can fulfill an order using the Fulfillment and the Location resources. You can follow this guide: https://shopify.dev/tutorials/manage-fulfillments-with-fulfillment-and-fulfillmentservice-resources

 

(Note these documents use GraphQL for its examples, but everything listed here you can do in REST as well)

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
hoggar
New Member
2 0 2

Here how you can Fulfill one complete order:

https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillment#create-2021-0...

Fulfill all line items from 1 location:

POST /admin/api/2021-01/orders/{order_id}/fulfillments.json
{"fulfillment": { "location_id": 123456789 }}

 

This is the simplest way, you can also add various other options like tracking numbers. urls. etc ...

gsosa2703
New Member
1 0 0

Hi,

Thanks for the answer, i have a doubt, the location_id is a mandatory field?

0 Likes
irook
New Member
3 0 0

Does this work for you?  I've been trying this exact request to fulfill all items on an order, and I always get a blank response.  Other actions work, just not this one.

 

I've also tried to get a list of fulfillments, and it always comes up

 

{"fulfillment_orders":[]}

 

I think I need to create a fulfillment_order for the order first, but I cannot find out how to do this.

Any advice on how to create a fulfillment_order for an order? 

0 Likes