Idempotent Order creation

Highlighted
New Member
14 0 0

I am trying to create an DraftOrder using the Admin graphql api and wanted to know if there is a way to guarantee that the orders can be uniquely identified during creation time. More broadly, how does Idempotency work  with the admin apis.

 

I stumbled on this Post: https://community.shopify.com/c/Shopify-APIs-SDKs/Idempotency-of-Admin-API-Requests-specifically-Inv...

This is an older post, wondering if anything has changed recently or if there is a workaround I can use in the interim.

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
486 41 105

Hi @cur8d,

 

There are no idempotent operations in the Shopify API.  You can not guarantee the draft order is uniquely identified prior to creation.  Simply when you make the call the return value will have the unique ID and name.

 

Hope that helps,

Ryan

 

Developer Experience @ Shopify
0 Likes
Highlighted
New Member
14 0 0

Thanks for the confirmation. Are there any plans on supporting this?

A pretty common pattern is to allow the api caller specify an optional Idempotent key, that can be used prevent duplicates. Is this something being considered?

 

Thanks!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
486 41 105

I don't think there are any plans currently to implement idempotent keys, however it is something that can definitely change in the future.

Developer Experience @ Shopify
0 Likes
Highlighted
Excursionist
38 0 2

Hi @Ryan  

I hope you are having a great weekend.

 

I am using GraphQL to create an order, so I first use the draftOrderCreate mutation and then the draftOrderComplete mutation.

But in this case, the order confirmation email was sent to customers.

Is there any way to prevent sending an email when using GraphQL?

 

Thank you & have a great weekend.

0 Likes