REST API Fulfillment error - expected Array to be a Array

REST API Fulfillment error - expected Array to be a Array

anniebaile
Shopify Partner
7 0 3

Hello there,

I'm working on sending up fulfillment and tracking orders to some test orders on our store, and in my journey I've come across an error that perplexes me...

 

 This is my cURL POST request (using FileMaker 20):

 

 

-X POST https://jakesales.myshopify.com/admin/api/2023-01/fulfillments.json
-H "Content-Type: application/json"
-H "X-Shopify-Access-Token: XXXXXXXXX"
--data-binary @$FulfillmentJSON -D $DumpHeaders

 

 

Where $FulfillmentJSON =

 

{
   "fulfillment":{
      "line_items_by_fulfillment_order":[
         {
            "fulfillment_line_items":[],
            "fulfillment_order_id":2222222222
         }
      ],
      "location_id":11111111111,
      "notify_customer":true,
      "tracking_info":[
         {
            "company":"FedEx",
            "number":"395033530588",
            "url":"https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=395033530588&cntry_code=us&locale=en_US"
         }
      ]
   }
}

 

 

(substituting data here)

 

I receive the response: {"errors":{"tracking_info":"expected Array to be a Array"}}

 

tracking_info sure looks like an array to me... I've tried sending tracking_info up as a string as suggested before by the community, but it formats the JSON incorrectly and definitely views it as just a string. Does anyone see what I'm doing wrong?

Reply 1 (1)

Shayne
Shopify Staff (Retired)
254 20 48

Hey Anniebaile,

Based on what's in the docs, you should be sending the tracking info as an object: https://shopify.dev/docs/api/admin-rest/2023-07/resources/fulfillment#post-fulfillments-fulfillment-...

The error message is definitely confusing, it's asking for an Array, which isn't what's documented. Can you try what's documented instead, and let me know how it goes?

Hope this helps!

Shayne | 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