0

I want to fetch the data from an external API and show it for my Catalog items. The API basically contains the details of my sellable items like product price, name and other details which properties I have already defined and added in Composer.

What should be the approach and how to do it?

3
  • Do you need to store data from external API in Sitecore Commerce in Catalog or you just need to show them to site visitors / customers when they are accessing product pages? Aug 7, 2018 at 5:56
  • How many products we are talking about roughly? Aug 7, 2018 at 5:57
  • Thanks for you response to the question @Peter. The number of products would be around 10000 but this might increase so storing would not be a best option.Even though I would like to understand the approach for both.
    – Amitabh
    Aug 7, 2018 at 6:10

1 Answer 1

1

I would see three approaches that you can use:

  1. Dynamically calling external API when there is need to have information about product like price, name and other details. Categories will be stored in Commerce as usual. Products will be taken from external API based on category id. When somebody hits the "Add to cart" button or "+-" quantity buttons you would set price, name and other fields for that particular cart line and it's components or you would push data as custom plugin / component if you need extra details. Then the price is "frozen" also for order once cart is ordered. Best to have external API lightweight like REST API or GraphQL. We implemented one commerce solution with similar approach. The biggest problem here is the reliability of external API. If that one is more down than working then second option would be better. Another issue with this approach is that you cannot do nice personalization or product promotion as data are not in Commerce dbs.

  2. Importing data from external API regularly e.g. night job. Build minion that would import all products and information about them throughout the night. With 100k+ products I think it shouldn't take long if you do it in batches. External API should support batch querying also for this. This is more reliable solution as it does not depend on external API so heavy and the load is more or less on commerce indexes. You can also do personalization and promotions much easier with this approach. See How to implement a Sitecore Commerce Minion for more information.

  3. Updating data from external API - This is "just" a small tweak to second option. You are in this case only updating data in Commerce Catalog with a small minion. You need to have some conditions about existing products so you can update / delete them if needed / not needed anymore. Best would be that External API has some special request that you send to it and it will respond with changes made in x hours / days. You then only process those rows / entries. You don't need to go through the whole catalog...

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.