GET DEMO Chat

 

 

How To Implement Product Search by UPC

This is the fourth in a series of “How To” posts that illustrate various ways in which you can use the Indix Product API.

We’ve been following along with fictional developers Christy and Ted as they build features into their ecommerce shopping app. Christy and Ted tossed around a tennis ball in their apartment headquarters, pumped about their new feature to return results by store.

Christy threw the ball off in a corner and stared at Ted. “Hey, what about our other testers who said they already had a product in mind? They just wanted to know all the stores where they could get it.”

“Wait, you mean like searching the web for all offers on a product? Hmmm… how to do that…”

Turns out it was super easy to enable users to look up product based on a code-based identifier like a UPC. Christy’s hand cream was lying nearby. She grabbed it, looked up the barcode and punched it into the Indix Product API.

Searching a product by UPC returns all offers for the product including variants, beneficial to check if bigger pack sizes offer better value.

Here’s what it looks like in the Offers Premium endpoint which exposes offers across different stores.

Query: https://api.indix.com/v2/offersPremium/products?countryCode=US&upc=792850259997&app_key=<enter_app_key>

Sample response:

{
  "message": "ok",
  "result": {
    "count": 8,
    "products": [
      {
        "categoryNamePath": "Health & Personal Care > Skin Care > Hands & Nails > Hand Creams & Lotions",
        "categoryId": 20732,
        "mpid": "503eb11a9464c202b794f46a6e86cf75",
        "categoryName": "Hand Creams & Lotions",
        "upcs": [
          "00792850259997"
        ],
        "brandName": "Burt's Bees",
        "minSalePrice": 13.89,
        "stores": {
          "270": {
            "storeId": 270,
            "offers": [
              {
                "sku": "B00KOCVRN8",
                "refurbishedOffers": 0,
                "priceHistoryAvailable": false,
                "salesRank": 0,
                "productUrl": "http://www.amazon.com/dp/B00KOCVRN8?psc=1",
                "userRatings": 0,
                "maxRating": 0,
                "addOnItem": false,
                "availability": "IN_STOCK",
                "upcs": [
                  "00792850259997"
                ],
                "avgRating": 0,
                "shippingText": "+ Free Shipping\n                                        
                "fulfilledBy": "",
                "pid": "ca97150b7d1a6fff1f0f27e9d78d24c3",
                "privateAttributes": {},
                "mpns": [],
                "newOffers": 2,
                "listPrice": 135.92,
                "buyBoxWinner": false,
                "additionalImageUrls": [],
                "salePrice": 135.92,
                "cartPrice": false,
                "lastRecordedAt": 1427255914052,
                "imageUrl": "https://images-na.ssl-images-amazon.com/images/I/51VuJ78qJpL._AC_UL246_SR190,246_.jpg",
                "usedOffers": 0,
                "seller": "Perfume'N'Gifts"
              },
              {
                "sku": "B00KOCVRN8",
                "refurbishedOffers": 0,
                "priceHistoryAvailable": true,
                "salesRank": 2238,
                "productUrl": "http://www.amazon.com/dp/B00KOCVRN8?psc=1",
                "userRatings": 0,
                "maxRating": 0,
                "addOnItem": false,
                "availability": "IN_STOCK",
                "upcs": [
                  "00792850259997"
                ],
                "avgRating": 0,
                "shippingText": "& FREE Shipping",
                "fulfilledBy": "Pharmapacks",
                "pid": "d9e593ae87bac41f58ee331c81a6cfa6",
                "privateAttributes": {},
                "mpns": [],
                "newOffers": 0,
                "listPrice": 121.2,
                "buyBoxWinner": true,
                "additionalImageUrls": [],
                "salePrice": 121.2,
                "cartPrice": false,
                "lastRecordedAt": 1469257172484,
                "imageUrl": "https://images-na.ssl-images-amazon.com/images/I/51VuJ78qJpL._AC_UL246_SR190,246_.jpg",
                "usedOffers": 0,
                "seller": "Pharmapacks"
              },
              {
                "sku": "B00KOCVRN8",
                "refurbishedOffers": 0,
                "priceHistoryAvailable": false,
                "salesRank": 1,
                "productUrl": "http://www.amazon.com/dp/B00KOCVRN8?psc=1",
                "userRatings": 0,
                "maxRating": 0,
                "addOnItem": false,
                "availability": "IN_STOCK",
                "upcs": [
                  "00792850259997"
                ],
                "avgRating": 0,
                "shippingText": "+ $6.25 shipping\n            
                "fulfilledBy": "",
                "pid": "aa26421ff45b500d19c4179b1c72ae8f",
                "privateAttributes": {},
                "mpns": [],
                "newOffers": 0,
                "listPrice": 13.89,
                "buyBoxWinner": false,
                "additionalImageUrls": [],
                "salePrice": 13.89,
                "cartPrice": false,
                "lastRecordedAt": 1454062636624,
                "imageUrl": "https://images-na.ssl-images-amazon.com/images/I/51VuJ78qJpL._AC_UL246_SR190,246_.jpg",
                "usedOffers": 0,
                "seller": "GrtStuff4Sale"
              },
              {
                "sku": "B00KOCVRN8",
                "refurbishedOffers": 0,
                "priceHistoryAvailable": false,
                "salesRank": 1,
                "productUrl": "http://www.amazon.com/dp/B00KOCVRN8?psc=1",
                "userRatings": 0,
                "maxRating": 0,
                "addOnItem": false,
                "availability": "IN_STOCK",
                "upcs": [
                  "00792850259997"
                ],
                "avgRating": 0,
                "shippingText": "& FREE Shipping",
                "fulfilledBy": "Bargains N More",
                "pid": "2f1aa7704871af48e2049dc348f5f91e",
                "privateAttributes": {},
                "mpns": [],
                "newOffers": 0,
                "listPrice": 19.94,
                "buyBoxWinner": true,
                "additionalImageUrls": [],
                "salePrice": 19.94,
                "cartPrice": false,
                "lastRecordedAt": 1454062636624,
                "imageUrl": "https://images-na.ssl-images-amazon.com/images/I/51VuJ78qJpL._AC_UL246_SR190,246_.jpg",
                "usedOffers": 0,
                "seller": "Bargains N More"
              },
            ],
            "storeName": "Amazon.com Marketplace",
            "title": "Burt's Bees Almond & Milk Hand Creme (Pack of 2 oz, 18"
          }
        },
        "brandId": 2896,
        "categoryIdPath": "10170 > 16813 > 17788 > 20732",
        "mpns": [],
        "countryCode": "US",
        "currency": "USD",
        "title": "Burt's Bees Almond & Milk Hand Creme (Pack of 2 oz, 18",
        "lastRecordedAt": 1469257172484,
        "imageUrl": "https://images-na.ssl-images-amazon.com/images/I/51VuJ78qJpL._AC_UL246_SR190,246_.jpg",
        "maxSalePrice": 142.39,
        "offersCount": 8,
        "storesCount": 1
      },
... Truncated for brevity

Easy as pie! Watch out for the next post where we explore searching products by MPN or SKU.

  Download the Pervasive Commerce White Paper
Request Enterprise Access Today

Leave a Reply

Your email address will not be published. Required fields are marked *