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
6360 583 1357

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 

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


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

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