422 (Unprocessable Entity) when fulfilling an order

supadu
New Member
2 0 0

Hello,

  We are experiencing an issue with trying to fulfil an order through the Shopify API. 

  This is the error response we receive:
  

422 (Unprocessable Entity)
    at stream.catch.then.data (/var/task/node_modules/got/index.js:386:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  name: 'HTTPError',
  host: undefined,
  hostname: 'cider-mill-press.myshopify.com',
  method: 'POST',
  path: '/admin/orders/2326199566468/fulfillments.json',
  protocol: 'https:',
  url: undefined,
  statusCode: 422,
  statusMessage: 'Unprocessable Entity',

 

The order only has 1 item, delivery with UPS Next Day Air® .  The order id is 2326199566468 . Thank you!

0 Likes
Greg_Kujawa
Shopify Partner
956 80 203

Can you provide the JSON request body you are sending?

0 Likes
supadu
New Member
2 0 0

Sure thing, here it is:

{
    "location_id": "39257407620",
    "tracking_number": "1Z0699430331881210",
    "tracking_company": "UPS",
    "notify_customer": true
}

Thanks for your help! 

0 Likes
Greg_Kujawa
Shopify Partner
956 80 203

Not too long ago there were some posts regarding fulfilling orders via the REST API. Here is one sample JSON request body that worked fine for me when I tested it. Note the enclosing "fulfillment": { } around the particulars, as well as specifying the line items. While I'm not sure it's required to specify the line items I do know the fulfillment enclosure is required!

{
"fulfillment": {
  "location_id": 203128,
  "tracking_number": "123456789",
  "service": "manual",
  "tracking_url": "https://shipping.xyz/track.php?num=123456789",
  "tracking_company": "Jack Black's Pack, Stack and Track",  
  "receipt": {},
  "line_items": [{"id": 4204529844276, "quantity": 1, "variant_id": null, "fulfillment_service":"manual" }],
  "notify_customer": false
  }
}

 

0 Likes