Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Rest API Query Variant with UPC

pythagoryan
Excursionist
21 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
Replies 2 (2)

PaulNewton
Shopify Partner
6273 572 1309

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


henrypieterson
Visitor
1 0 0

Set up an API call in Zapier to return product information based on a UPC (Universal Product Code). However, the screenshot you provided seems to be missing some details.

Here's a general guide on how you might approach making an API call in Zapier:

  1. Trigger Event: First, you need to determine the trigger that initiates the Zap. This could be an event in another app that leads to the UPC being available in Zapier.

  2. Choose Action App: After the trigger, you'd choose an action app. This is where you want to send your API call. It could be an app that supports custom API calls or a specific API integration.

  3. Set Up Action: Configure the action step with the necessary details. This would include the endpoint URL, HTTP method (GET, POST, etc.), headers, and any required parameters.

  4. Dynamic Data: In Zapier, you can use the data from the trigger event dynamically in your API call. Ensure that you are passing the UPC dynamically to the appropriate field in your API call setup.

  5. Test the Zap: After configuring, it's crucial to test the Zap to ensure that the API call is working as expected. This helps you identify and fix any issues early on.

Since you are working with product information and UPC codes, make sure you have the correct API endpoint and any required authentication tokens or API keys.