Out now! Check out the Poll results: Do you have a Shopify store?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Fulfillments API Confusion

Solved

Fulfillments API Confusion

gsingh0317
Shopify Partner
10 0 7

Hello!

This accepted answer here from Shopify Dev's (https://community.shopify.com/c/fulfillment-api-deprecation/rest-fulfillment-api-deprecation-has-no-...) explains how the fulfillments API is not fully going away, only some endpoints are being moved to the FulfillmentOrders API.

 

However, there is still some confusion about how we will *exactly* create a fulfillment in the 2022 REST API for an order that is fulfilled outside of Shopify via a TMS and if that is being moved to FulfillmentOrders or not as well.

The post referenced above does not mention specifically if only POST /admin/api/2021-01/orders/{order_id}/fulfillments.json will go away while the new 2022 version POST /admin/api/2022-07/orders/{order_id}/fulfillments.json will remain

 

(OR)

 

There is no POST /admin/api/2022-07/orders/{order_id}/fulfillments.json endpoint and it is being migrated into FulfillmentOrders as well.

 

Can you please clarify the above? Our whole intent is to simply fulfill line_items (from the appropriate locations) with tracking_number and tracking_company.

Accepted Solution (1)
SmeadDev
Shopify Partner
51 2 15

This is an accepted solution.

For anybody who needs assistance, I can chime in with what I did to conform to their API version deprecation of the Fulfillment endpoint.

 

1)  I had to change my API call to use token-based authentication rather than Basic Authentication.

2)  For each order being fulfilled, I had to do a GET request to get the corresponding fulfillment order object. So my first endpoint format was as follows (C# code here):

string url = String.Format("https://{0}/admin/api/{1}/orders/{2}/fulfillment_orders.json", storeUrl, apiVersion, shopifyOrderNo);

the api version is 2022-07 here.

 

3) Then, you create a JSON payload like so:

string json = JsonConvert.SerializeObject(new FulfillmentObject
            {
                fulfillment = new Fulfillment
                {
                    message = "Your MOL item has shipped",
                    notify_customer = notify_customer,
                    location_id = Convert.ToInt64(locationId),
                    tracking_info = new TrackingInfo
                    {
                        number = trackingNumber,
                        url = "https://www.ups.com",                     
                        company = "UPS"

                    },
                    line_items_by_fulfillment_order = lineItemsByFulfillmentOrder //array

                }
            });

 

4) Endpoint:

 

string url = String.Format("https://{0}/admin/api/{1}/fulfillments.json", shopifyStoreUrl, apiVersion);

 

5) On all your api calls, be sure to include the following header key:

 

request.Headers.Add("X-Shopify-Access-Token", [YOUR API TOKEN]);

View solution in original post

Replies 5 (5)

SmeadDev
Shopify Partner
51 2 15

I am patiently waiting for clarification on this as well. When we switched our store to the new 2022-07 API version, the /admin/api/2022-07/orders/{order_id}/fulfillments.json endpoint no longer worked (getting a "NotFound" response). But if we stay on the 2022-04 API version, the URL above (replaced 2022-07 with 2022-04, of course) works, although we continue to get the deprecation header saying that this endpoint is being deprecated.

 

It would be nice if someone from Shopify could chime in and provide some direction as to how we can mark orders outside of Shopify as being fulfilled going forward.

manishjha01
Shopify Partner
4 0 1

Any updates from Shopify on this? waiting...

SmeadDev
Shopify Partner
51 2 15

This is an accepted solution.

For anybody who needs assistance, I can chime in with what I did to conform to their API version deprecation of the Fulfillment endpoint.

 

1)  I had to change my API call to use token-based authentication rather than Basic Authentication.

2)  For each order being fulfilled, I had to do a GET request to get the corresponding fulfillment order object. So my first endpoint format was as follows (C# code here):

string url = String.Format("https://{0}/admin/api/{1}/orders/{2}/fulfillment_orders.json", storeUrl, apiVersion, shopifyOrderNo);

the api version is 2022-07 here.

 

3) Then, you create a JSON payload like so:

string json = JsonConvert.SerializeObject(new FulfillmentObject
            {
                fulfillment = new Fulfillment
                {
                    message = "Your MOL item has shipped",
                    notify_customer = notify_customer,
                    location_id = Convert.ToInt64(locationId),
                    tracking_info = new TrackingInfo
                    {
                        number = trackingNumber,
                        url = "https://www.ups.com",                     
                        company = "UPS"

                    },
                    line_items_by_fulfillment_order = lineItemsByFulfillmentOrder //array

                }
            });

 

4) Endpoint:

 

string url = String.Format("https://{0}/admin/api/{1}/fulfillments.json", shopifyStoreUrl, apiVersion);

 

5) On all your api calls, be sure to include the following header key:

 

request.Headers.Add("X-Shopify-Access-Token", [YOUR API TOKEN]);
gsingh0317
Shopify Partner
10 0 7

You are awesome, we were able to confirm this as well!

SmeadDev
Shopify Partner
51 2 15

Glad the solution worked!