Error code 422 Unprocessable Entity (An error occurred, please try again)

Solved
Highlighted
New Member
6 0 0

Hi there,

 

We are using the shopify_api gem (https://github.com/Shopify/shopify_api) to make REST API requests through our private apps. Some of our requests to cancel or complete fulfillments fail with the 422. The response error messages do not tell us what the problem is. I do not know how to get the X-Request-Id when using this gem so I can't provide that but I can provide order and fulfillment IDs of requests that are failing in a private chat/email. Please advise.

 

David

0 Likes
Highlighted
New Member
6 0 0

UPDATE:

 

When I use Postman to make a request to cancel a fulfillment using the same Admin API credential that our app is using, I get a response code of 403 with the message: "The api_client does not have the required permission(s)." Not sure if this and the 422 are related but they both fail.

 
0 Likes
Highlighted
New Member
6 0 0

More information:

 

We are using one of the latest versions of the shopify_api gem

gem 'shopify_api', '~> 9.0', '>= 9.0.1'

 

I have confirmed that the private app we setup for this customer has the Read and Write access for the fulfillments Admin API. We are using these credentials to make requests.

 

Here is the request method and path ActiveRecord is using that returns the 422:

POST https://[store_name].myshopify.com:443/admin/api/2020-01/orders/[order_id]/fulfillments/[fulfillment_id]/cancel.json

 

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 129

This is an accepted solution.

@dcflx ,

 

Re-posting from the other forum thread for visibility:

 

As of API Version 2020-01, Shopify did update how it handles fulfillments and fulfilling orders. There is a new resource introduced (FulfillmentOrders) that represents the groups of line items in an order that are fulfilled together and this resource gives you more control over managing fulfillment. There are also new access scopes your apps will need to use this resource. For a detailed guide on the new workflow in API Version 2020-01, please read this guide: https://shopify.dev/tutorials/manage-fulfillments-with-fulfillment-and-fulfillmentorder-resources 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

New Member
6 0 0

@hassain thank you!

0 Likes