Re: Integrate products from Supplier API

Integrate products from Supplier API

GeorgeCha
Visitor
2 0 1

I have access to the supplier API which is giving me data in JSON and XML, I would like to connect this to my Shopify store so that when the supplier changes any product details on their site the changes should automatically reflect on my Shopify site as well. I would also like to manipulate some of the supplier data such as adding a markup on their prices when they are getting to my store.

 

Can someone assist with how I can do that?

Replies 9 (9)

Liam
Community Manager
3108 341 879

Hi GeorgeCha,

 

Great to hear you're looking to integrate your store with a suppliers API. You can achieve this workflow by implementing middleware that connects the supplier's API with your Shopify store. Here's a general approach:

 

1. Fetch the Data from the Supplier's API:

First, you would write a script that pulls the JSON data from the supplier's API. This script would need to authenticate with the supplier's API, fetch the data, and then convert it into a format that can be used by Shopify. XML is less supported by Shopify, so if you can use just JSON that will make things easier for you. 

 

2. Parse and Transform the Data:

Once you've fetched the data, you can parse it and transform it into a format that Shopify can understand, eg: use a function like json.loads() in Python or JSON.parse() in JavaScript to turn the JSON string into a data structure you can work with. These are the properties that are accessible with the Product resource, to give you a model of how data could be structured so it's compatible with Shopify's Admin API. 

 

3. Push the Data to Shopify:

After you've transformed the data, you would push it to your Shopify store using Shopify's API. Check out our documentation on API endpoints for creating and updating products, which you can use for this part of the process.

 

This approach could be implemented in any programming language that can make HTTP requests and process JSON or XML data. Python, Node.js, Ruby, etc., could all be used for this purpose.

 

One important thing to note is that Shopify throttles API requests depending on the API you're using, so you may need to rate limit your requests to avoid exceeding Shopify's API limits

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

GeorgeCha
Visitor
2 0 1

Liam, thanks so much for this. Let me try it out.

Adrian_CSH
Visitor
1 0 1

Hi Liam,

 

Thank's for your info. Could you sugest someone, a developer, to support me in doing all the steps you mentioned?  I'm in a similar situation but I don't know any programing code 🙂 Thank you .

 

MariaDawod
Visitor
1 0 0

Hi Liam,

how to hire you as Shopify developer to do it? 

Liam
Community Manager
3108 341 879

You can hire developers from the Shopify Partner Directory

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

JoelMmt
Shopify Partner
1 0 0

Hi Liam,

 

your solution sounds like a great option for what we are trying to accomplish, which is similar to the OPs objective. However, we'd like to use it in both directions, from Supplier to Shop (getting their prices, product data, stock, etc.) and also from Shop to Supplier (sending orders, customer data, delivery address, etc.).

 

Does your approach also work in the other direction, from Shop to Supplier? From what I can understand of the Shopify API, it looks possible (e.g. "Retrieve a list of orders"), but I can't really tell/confirm from your description above.

 

So for example, if a user makes an order in our Shopify shop, can that order be sent to the middleware (which will handle transforming the data and posting the XML to the supplier)? If yes, would it work via webhooks or similar, to trigger the Shopify API and send all the order data to the middleware? Or would we rather need a cron job having our middleware fetching the (new) orders at certain intervals?

Thanks for your support!

 

Best regards,

Joël

scottydogrva
Visitor
1 0 0

This is a great overview Liam!  Is there a good resource on creating middleware?  I am new to Shopify development

michal_sms
Visitor
2 0 0

I can help with that. Please reach out to me at [email protected]

HyperspaceInc
Shopify Partner
1 0 0

Hyperspace has done this with multiple companies. If you need assistance or just have general questions we are happy to have a conversation. Thank you. [email protected]