Fulfillment 422 Unprocessable entity

KevinZZZ
New Member
2 0 0

I'm creating a fulfillment .

I'm Posting to: https://jinyefei.myshopify.com/admin/api/2020-04/orders/3675209072815/fulfillments.json

Method: POST, content="application/json" encoding: UTF-8

Here's what I am sending:

{

"fulfillment":{

    "location_id":60191867055,

    "tracking_number":"6031521816293",

    "tracking_company":"imile",

    "tracking_urls":["https://www.51tracking.com/imile-tracking?number=6031521816293"],

    "notify_customer":true

    }

}

 

I'm getting an Unprocessable entity 422 error, but I don't see any detail of the error in the response.

Could someone tell me how the json is wrong or how to get more info from the response?  

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 243

If you've verified you are referencing a valid order ID, referencing a valid location ID, and referencing an order that has an appropriate status, then have you looked at possibly including the line items in your request body?

Something like this...

{
"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": 8949679358140, "quantity": 1, "variant_id": 31513252823092, "fulfillment_service":"manual" }],
  "notify_customer": false
  }
}
0 Likes
KevinZZZ
New Member
2 0 0

Yeah,I'm sure I hava a valid Order ID and Location ID.

This is the document website:  https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillment#create-2020-0...

and the screenshot:

KevinZZZ_0-1615966250035.png

So I need not put the line item IDs into the request body.

I always used the api before,but I get the 422 http response code recently.I could't locate the error~

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 243

If you've double-checked everything then I'd suggest providing a X Request ID value that appears in the response header when this issue has happened. That way Shopify staff can look into their logs to see additional details on their end. Only other thing I can think of is that if an order has multiple line items, and the line items don't all have the same defined fulfillment service that's an issue...

0 Likes