Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Rest API Query Variant with UPC

Rest API Query Variant with UPC

pythagoryan
Excursionist
22 0 9

Hello!

 

Straight up, I don't have a lot of experience working with APIs. I'm mostly a front-end developer.

 

I'd like to send out an API call from Zapier to return a product based on the UPC.

 

I'm definitely doing this wrong but here's what I set up:

 

pythagoryan_0-1702423759639.png

 

Any help is appreciated! Thanks in advance!

 

Ryan R. Irwin
Director of Technology
SkyCo Distro & Hazel Sky Smoke Shop
Reply 1 (1)

PaulNewton
Shopify Partner
7722 678 1628

If the service allows GraphQL api access then use that instead to query variant by barcode.

https://shopify.dev/docs/api/admin-graphql/2023-01/queries/productvariants#argument-productvariants-... 

 

For REST refer to the reference

https://shopify.dev/docs/api/admin-rest/2023-04/resources/product-variant

There is no barcode parameter to query in a productVariant in the REST api

 

So using the REST api you need to just get all the variants, using pagination, then filter down to the barcode after you have them all in the automation service.

 

Alternatively use that automation tool, or yet another automation tool like  mechanic , to premake a data structure or an endpoint that uses the barcode as a key for the variants data.

https://learn.mechanic.dev/platform/cache/endpoints#configuration 

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org