REST Admin API - Fulfill an order with multiple tracking numbers AND multiple tracking urls

Highlighted
Shopify Partner
13 2 3

I'm trying to create a fulfillment event/notification for an order with multiple tracking numbers and multiple tracking URLS for the same order. I can already do this for an order but with just a single tracking number and tracking URL but I get a HTTP 400 response from Shopify REST when I try to create a fulfillment event for multiple tracking numbers etc.

Server returned HTTP response code: 400 for URL: https://bluecrest-direct.myshopify.com/admin/api/2019-07/orders/2471285162073/fulfillments.json

According to the manual it is possible to create an order fulfillment using multiple tracking numbers (https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillment#create-2020-1.... I've tried the following 2 alternatives of the JSON request in my JAVA code without success:

MULTIPLE TRACKING NUMBERS AND URLS

sonInputString = "{\"fulfillment\":{\"location_id\":\"12345678\",\"tracking_numbers\":\""+TRACKING_NUMBERS+
      "\",\"tracking_company\":\"Royal Mail\",\"tracking_urls\":\""+TRACKING_URLS+"\",\"status\":\"success\"}}";

 

MULTIPLE TRACKING NUMBERS ONLY

jsonInputString = "{\"fulfillment\":{\"location_id\":\"12345678\",\"tracking_numbers\":\""+TRACKING_NUMBERS +
      "\",\"tracking_company\":\"Royal Mail\",\"status\":\"success\"}}";
0 Likes
Highlighted
Shopify Staff
Shopify Staff
10 2 1

@gdastgir ,

Happy to help you out with this.

Given the 400 (Bad Request) my initial thoughts are about the variables TRACKING_NUMBERS and TRACKING_URLS. Making a POST to the REST fulfillments endpoint requires tracking_numbers and tracking_urls to be an array of strings.

For example, building on your sample where you're constructing a JSON string 

jsonInputString = "{\"fulfillment\":{\"location_id\":\"12345678\",\"tracking_numbers\":[\"123\",\"321\"],\"tracking_company\":\"Royal Mail\",\"tracking_urls\":[\"someurl\",\"otherurl\"],\"status\":\"success\"}}";

 I hope this helps out. 

Regards,

John

John C | Developer Support Specialist @Shopify
0 Likes