Code Monkey home page Code Monkey logo

icecat's Introduction

Icecat API

Version License Build Status Known Vulnerabilities

With this package you can read the worldwide product information data from Icecat. This product information comes from editors like participating manufacturers. You can use this package for webshops, comparison websites, online shopping directories or enterprise resource planning systems.

Getting started

1) Icecat account

To create a Icecat account, go to the Icecat registration page.

2) Installation

Install the Icecat Node.js package by running the following command within your project's root directory:

npm install icecat --save

3) Basic usage

const icecat = require('icecat');

const icecatClient = new icecat('username', 'password');

// Language: en, GTIN: 4948570114344 (GTIN: EAN, UPC or GTIN-13/JAN)
icecatClient.openCatalog
  .getProduct('EN', '4948570114344')
  .then(function(product) {
    console.log('Description: ' + product.getLongDescription());

    const productImages = product.getImages();

    console.log('Product images:');
    for (let i in productImages) {
      console.log(productImages[i].ThumbImg);
    }
  })
  .catch(function(reason) {
    console.error('Error or timeout', reason);
  });

Demo: https://runkit.com/greencore/icecat-demo

openCatalog

getProduct(Language, GTIN)

Arguments:

Returns: productObject

getProductById(Language, ProductId)

Arguments:

Returns: productObject

getProductBySKU(Language, Brand, SKU)

Arguments:

Returns: productObject

getProductByXMLdata (xmldata)

Arguments:

  • xmlData: XML data from an Icecat XML file or XML web service

Returns: productObject

productObject

getReturnCode

  • returnCode.FAIL (-1)
  • returnCode.SUCCESS (1)

getErrorMessage
returns ErrorMessage {string}
Example: The requested XML data-sheet is not present in the Icecat database.

getName
returns Product Name {string}
Example: X4071UHSU-B1

getTitle
returns Product Title {string}
Example: iiyama X4071UHSU-B1 39.5" LED 4K Ultra HD Black public display

getReleaseDate
returns Product Release Date YYYY-MM-DD {string}
Example: 2015-10-04

getLongDescription
returns {string}

getShortDescription
returns {string}

getProductInfoPDFurl
returns {string}
Example: http://pdfs.icecat.biz/pdf/48068167-5427.pdf

getProductManualPDFurl
returns {string}

getProductUrl
returns {string}

getSupplier
returns {string}
Example: iiyama

getCategory
returns {string}
Example: public displays

getFamily
returns {object}
Example: {"id":"30340","name":"ProLite"}

getId
Get the Icecat product ID
returns {string}
Example: 29900045

getEan
Get the first EAN from the productXML
returns {string}
Example: 4948570114344

getImages
returns {array}
Example:

[
  {
    IsMain: 'Y',
    HighImg: 'http://images.icecat.biz/img/gallery/29900045_1198.jpg',
    LowImg: 'http://images.icecat.biz/img/gallery_lows/29900045_1198.jpg',
    ThumbImg: 'http://images.icecat.biz/img/gallery_thumbs/29900045_1198.jpg'
  },
  {
    IsMain: undefined,
    HighImg: 'http://images.icecat.biz/img/gallery/29900045_3889.jpg',
    LowImg: 'http://images.icecat.biz/img/gallery_lows/29900045_3889.jpg',
    ThumbImg: 'http://images.icecat.biz/img/gallery_thumbs/29900045_3889.jpg'
  },
  {
    IsMain: undefined,
    HighImg: 'http://images.icecat.biz/img/gallery/29900045_6765.jpg',
    LowImg: 'http://images.icecat.biz/img/gallery_lows/29900045_6765.jpg',
    ThumbImg: 'http://images.icecat.biz/img/gallery_thumbs/29900045_6765.jpg'
  }
];

getSpecifications
returns {array}

getMultimediaObjects
returns {Array}

getCategoryFeatureGroups
returns {Array}
Example:

[
  { id: '10074', name: 'Display' },
  { id: '10080', name: 'Audio' },
  { id: '10083', name: 'Ports & interfaces' },
  { id: '10073', name: 'Weight & dimensions' },
  { id: '10081', name: 'Power' },
  { id: '10084', name: 'Operational conditions' },
  { id: '10871', name: 'Technical details' },
  { id: '10078', name: 'Packaging data' },
  { id: '10101', name: 'Other features' },
  { id: '10869', name: 'Design' },
  { id: '10870', name: 'Performance' },
  { id: '16263', name: 'Computer system' }
];

About Icecat

Icecat Url
services https://icecat.biz/menu/services/index.html
product info https://icecat.biz/

License

MIT License

icecat's People

Contributors

alexdrans avatar dependabot[bot] avatar derkobe avatar georgyfarniev avatar greencore avatar jbactad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

icecat's Issues

Targetted Node version

Currently, we're (recently) targeting >=6.

Is this really necessary? I think we could support lower, say >=4 for xml2js?

If ProductGallery is undefined, getImages() crash

Cannot read property 'length' of undefined at icecat.getImages (icecat/lib/OpenCatalog/product.js:193:40)

if (!this.productData.ProductGallery.length || !this.productData.ProductGallery[0].ProductPicture.length)
isn't safe if ProductGallery is undefined.

getProductManualPDFurl returns "PDFURL" instead of "ManualPDFURL"

method getProductManualPDFurl returns "PDFURL" instead of "ManualPDFURL"

<ProductDescription ID="48068167" LongDesc="<b>Stylish 40” screen with 4K resolution and USB hub</b>\n\nThe ProLite ........" ManualPDFSize="3332489" ManualPDFURL="http://pdfs.icecat.biz/pdf/48068167-5566-manual.pdf" PDFSize="285343" PDFURL="http://pdfs.icecat.biz/pdf/48068167-5427.pdf" ShortDesc="39.5 MVA, 3 ms, 350 cd/m², 3840 x 2160, 16:9, PiP, PbP, HTCP, VESA, OSD, 3 x USB 3.0, HDMI, VGA, Black" URL="http://www.iiyama.com/gl_en/products/prolite-x4071uhsu-b1/" WarrantyInfo="" langid="1"/>

Not all properties are available

Any toughts on adding all properties from the xml response?

For example:
EndOfLifeDate
ReasonToBuy array
BulletPoints array
Reviews array

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.