Admin Graphql Retry Header/202 Response

Solved
Highlighted

I recently discovered that AvalaraTax calculations happen async which means when creating a draftOrder, the initial response may have no tax which within ~1-5seconds updates with the correct tax.

 

We're using the Graphql Admin API (draftOrderCalculate -> draftOrderCreate -> draftOrderComplete) and I noticed that the graphql api returns a 200 Response with no Retry-After header. However! The REST api returns a 202 with a Retry-After 1 which would allow us to know to poll for tax calculations.

 

Am I missing something with graphql? Is there no method to indicate that we need to poll. Now we're forced to poll every order for X amount or use the REST API to get accurate order totals with tax/shipping.

 

Screen Shot 2019-10-14 at 1.29.58 PM.png

Check out Store Recon on the app store.
0 Likes

Success.

Shopify Staff
Shopify Staff
1113 77 153

Hi @gilg , 

 

In GraphQL, it's standard to respond with a 200 status code for the vast majority of requests, even when an error occurs. The only time I know where something other than a 200 response would occur is when a request was throttled or an issue occurred at the HTTP level. 

 

As such, I think it would be out of spec to respond in GraphQL with a 202 - but perhaps we could respond with a message to let you know when you could check again if the draft wasn't ready yet. I'll log an issue with our orders team about this and see if there's anything we can do. 

1 Like

Awesome thanks Josh. An indication of some sort that tax/shipping is still being calculated would be invaluable.

Check out Store Recon on the app store.
0 Likes