GET DEMO Chat

 

 

How To Implement Product Search by SKU or MPN

This is the fifth 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 were learning more and more about code-based product identifiers every day.  They were happy that they powered product search by UPC.

Then Ted thought out loud, “It seems like the reliability and availability of code-based identifiers varies. What if someone has a more store-specific identifier like a SKU or a brand-specific one like MPN?”

Christy replied, “That’s true. It would present the product information in a different way and help compares prices among other things, right? We should be able to do that.”

To look up a product by MPN, you need the respective string and the Brand ID. This is useful in enabling consumers to comparison shop as they can see competing offers from different stores. For instance, say you were looking for a particular men’s running shoe from New Balance (Brand ID= 3874, MPN= M690RT4).

This is what the query looks like in the Offers Premium endpoint:

Query: https://api.indix.com/v2/offersPremium/products?countryCode=US&brandId=3874&mpn=M690RT4&app_key=<enter_app_key>

Sample response:

"message": "ok",
  "result": {
    "count": 3,
    "products": [
      {
        "categoryNamePath": "Shoes > Men > Athletic > Running",
        "categoryId": 17538,
        "mpid": "89845f5881f981c5945fab566309fc1d",
        "categoryName": "Running",
        "upcs": [
          "438835",
          "00889516495636"
        ],
        "brandName": "New Balance",
        "minSalePrice": 55.99,
        "stores": {
          "104": {
            "storeId": 104,
            "offers": [
              {
                "sku": "6384492",
                "refurbishedOffers": 0,
                "priceHistoryAvailable": false,
                "salesRank": 0,
                "productUrl": "http://www.onlineshoes.com/mens-new-balance-690v4-running-shoe-toxic-equinox-p_id438543#9#4E#X+Wide#Toxic%2FEquinox",
                "userRatings": 1,
                "maxRating": 5,
                "addOnItem": false,
                "availability": "IN_STOCK",
                "upcs": [],
                "avgRating": 5,
                "shippingText": "Free shipping",
                "fulfilledBy": "",
                "pid": "8f9d60cd1bd8a6a45dd7257e5680df3d",
                "privateAttributes": {},
                "mpns": [
                  "M690RT4"
                ],
                "newOffers": 0,
                "listPrice": 59.95,
                "buyBoxWinner": false,
                "additionalImageUrls": [],
                "salePrice": 59.95,
                "cartPrice": false,
                "lastRecordedAt": 1454308790566,
                "imageUrl": "http://s3.onlineshoes.com/images/br008/mens-new-balance-690v4-running-shoe-toxic-equinox-484650_200_45.jpg",
                "usedOffers": 0,
                "seller": ""
              },
              {
                "sku": "6384494",
                "refurbishedOffers": 0,
                "priceHistoryAvailable": false,
                "salesRank": 0,
                "productUrl": "http://www.onlineshoes.com/mens-new-balance-690v4-running-shoe-toxic-equinox-p_id438543#10#4E#X+Wide#Toxic%2FEquinox",
                "userRatings": 1,
                "maxRating": 5,
                "addOnItem": false,
                "availability": "IN_STOCK",
                "upcs": [],
                "avgRating": 5,
                "shippingText": "Free shipping",
                "fulfilledBy": "",
                "pid": "15173aa3865f84f3fcea9e26adb1a1bc",
                "privateAttributes": {},
                "mpns": [
                  "M690RT4"
                ],
                "newOffers": 0,
                "listPrice": 59.95,
                "buyBoxWinner": false,
                "additionalImageUrls": [],
                "salePrice": 59.95,
                "cartPrice": false,
                "lastRecordedAt": 1454308790566,
                "imageUrl": "http://s3.onlineshoes.com/images/br008/mens-new-balance-690v4-running-shoe-toxic-equinox-484650_200_45.jpg",
                "usedOffers": 0,
                "seller": ""
              },
... Truncated for brevity

Similarly, if we have a SKU and want to look up all the offers for a product within a store, we would need the Store ID. So for the same New Balance men’s running shoe in a given color, the SKU is 6384492 and Store ID is 104.

Query: https://api.indix.com/v2/offersPremium/products?countryCode=US&storeId=104&sku=6384492&app_id=<enter_app_id>&app_key=<enter_app_key>

Sample response:

{
  "message": "ok",
  "result": {
    "count": 1,
    "products": [
      {
        "categoryNamePath": "Shoes > Men > Athletic > Running",
        "categoryId": 17538,
        "mpid": "89845f5881f981c5945fab566309fc1d",
        "categoryName": "Running",
        "upcs": [
          "00889516495636"
        ],
        "brandName": "New Balance",
        "minSalePrice": 55.99,
        "stores": {
          "104": {
            "storeId": 104,
            "offers": [
              {
                "sku": "6384492",
                "refurbishedOffers": 0,
                "priceHistoryAvailable": false,
                "salesRank": 0,
                "productUrl": "http://www.onlineshoes.com/mens-new-balance-690v4-running-shoe-toxic-equinox-p_id438543#9#4E#X+Wide#Toxic%2FEquinox",
                "userRatings": 1,
                "maxRating": 5,
                "addOnItem": false,
                "availability": "IN_STOCK",
                "upcs": [],
                "avgRating": 5,
                "shippingText": "Free shipping",
                "fulfilledBy": "",
                "pid": "8f9d60cd1bd8a6a45dd7257e5680df3d",
                "privateAttributes": {},
                "mpns": [
                  "M690RT4"
                ],
                "newOffers": 0,
                "listPrice": 59.95,
                "buyBoxWinner": false,
                "additionalImageUrls": [],
                "salePrice": 59.95,
                "cartPrice": false,
                "lastRecordedAt": 1454308790566,
                "imageUrl": "http://s3.onlineshoes.com/images/br008/mens-new-balance-690v4-running-shoe-toxic-equinox-484650_200_45.jpg",
                "usedOffers": 0,
                "seller": ""
              },
              {
                "sku": "6384494",
                "refurbishedOffers": 0,
                "priceHistoryAvailable": false,
                "salesRank": 0,
                "productUrl": "http://www.onlineshoes.com/mens-new-balance-690v4-running-shoe-toxic-equinox-p_id438543#10#4E#X+Wide#Toxic%2FEquinox",
                "userRatings": 1,
                "maxRating": 5,
                "addOnItem": false,
                "availability": "IN_STOCK",
                "upcs": [],
                "avgRating": 5,
                "shippingText": "Free shipping",
                "fulfilledBy": "",
                "pid": "15173aa3865f84f3fcea9e26adb1a1bc",
                "privateAttributes": {},
                "mpns": [
                  "M690RT4"
                ],
                "newOffers": 0,
                "listPrice": 59.95,
                "buyBoxWinner": false,
                "additionalImageUrls": [],
                "salePrice": 59.95,
                "cartPrice": false,
                "lastRecordedAt": 1454308790566,
                "imageUrl": "http://s3.onlineshoes.com/images/br008/mens-new-balance-690v4-running-shoe-toxic-equinox-484650_200_45.jpg",
                "usedOffers": 0,
                "seller": ""
              },
... Truncated for brevity

Products can be looked up in many different ways through the Indix Product API. Watch out for the next post as we show you how to power searching products by URL.

  Download the Pervasive Commerce White Paper
Get API Walk-Through

Leave a Reply

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