@pgprojectx/bazaarvoice-sdk

1.0.0 • Public • Published

@pgprojectx/bazaarvoice-sdk

API wrapper for BazaarVoice

Table of Contents

Install

# For JavaScript usage
npm install --save-exact @pgprojectx/bazaarvoice-sdk

# For CLI usage
npm install --global @pgprojectx/bazaarvoice-sdk

Usage

const bazaarvoice = require('@pgprojectx/bazaarvoice-sdk');

const client = bazaarvoice({
  host: 'https://api.bazaarvoice.com',
  apiVersion: '5.4',
  apiKey: 'apiKey'
});

// Get Product Reviews
const reviews = await client.getProductReviews('000123645678901');
console.log(reviews);
// {
//   "reviewCount": Number,
//   "reviews": Array,
//   "rating": Number
// }

Configuration Files

Create an rc file to set defaults, so you don't have to pass a host, apiKey, and apiVersion flag to every command.

# ~/.bazaarvoicerc
host = https://api.bazaarvoice.com
apiKey = your-api-key
apiVersion = 5.4

@pgprojectx/bazaarvoice-sdk will walk the directory tree looking for rc files, so you can create one in the root of your project's directory to make the CLI context aware.

Commands

Get Product Reviews

Retrieve product review information for a specified product. The results are written to stdout

> bazaarvoice-sdk get-product-reviews -h
bazaarvoice-sdk get-product-reviews [productId]

Get product reviews for a product ID

Options:
  --version          Show version number                               [boolean]
  --host, --apiHost  BazaarVoice API hostname                         [required]
  --apiKey           API key for BazaarVoice                          [required]
  --apiVersion       BazaarVoice API version                          [required]
  --productId        Product ID
  --raw              Return full response data
  -h                 Show help                                         [boolean]

Notes

BazaarVoice does not return 404s for non-existing products. So default responses will result in the following object

{
  "reviewCount": 0,
  "reviews": [],
  "rating": false
}

Package Sidebar

Install

npm i @pgprojectx/bazaarvoice-sdk

Weekly Downloads

58

Version

1.0.0

License

none

Unpacked Size

6.22 kB

Total Files

6

Last publish

Collaborators

  • lucasfrazier
  • mitchell0625
  • boggsey
  • btrane
  • joshuarose
  • mattgj
  • johndavidback
  • nogorilla
  • pgalchemy-ops