npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-countbox-api

v0.2.3

Published

countbox api

Downloads

15

Readme

CountBOX API v2 (NodeJS SDK)

for countbox api v2

install nodejs version >= 0.4.2, recommended version of nodejs >= 0.6.2

install package: `npm install node-countbox-api --save'

create file touch sample.js

write to file (smaple for Node >= 0.6):

var login = process.env.LOGIN;
var pass = process.env.PASS;
var Api = require('node-countbox-api')(login, pass);

Api
  .getProfile()
  .then(response => console.log('getProfile', response))
  .catch(error => console.log('getProfile ERROR', error));

and run: [email protected] PASS=passwebapi node sample.js;

All Functions:

var login = process.env.LOGIN;
var pass = process.env.PASS;
var countbox = require('node-countbox-api')

/**
 * Recover password
 * @static
 * @param email {String} email for recover password
 * @param [format] {String} 'xml' or 'json' (default 'json')
 * @returns {{promise, resolve, reject}}
 */
countbox.recoverPassword('[email protected]')

var Api = countbox(login, pass);

/**
 * Get Profile data
 * @returns {{promise, resolve, reject}}
 */
Api
  .getProfile()
  .then(response => console.log('getProfile', response))
  .catch(error => console.log('getProfile ERROR', error));

/**
 * Get all locations "points"
 * @param [format] {String} or 'xml' or 'json' (default 'json')
 * @returns {{promise, resolve, reject}}
 */
Api
  .getPoints()
  .then(response => console.log('getPoints', response))
  .catch(error => console.log('getPoints ERROR', error));

/**
 * Put financial data on a server
 * @params data {Object} - financial data
 * @params data.id {Integer|String} - location (point) ID (required)
 * @params data.profit {Number} - (money) daily receipts (required)
 * @params data.checks {Number} - the number of checks per day (required)
 * @params data.date {Date|String} - report date. String format (ISO 8601) (required)
 * @returns {{promise, resolve, reject}}
 */
Api
  .addFinance({
    id: 1,
    profit: 15670.23,
    checks: 201,
    date: new Date(),
  })
  .then(response => {
    console.log(response);

    var options = {
      id: 1,
      datebegin: '2016-01-01',
      dateend: '2017-01-01',
      groupType: 1,
      isAllTime: false,
    };

    /**
     * Get financial data from server
     * @param options {Object} - request params
     * @param options.id {Number|String} - ID of point, or IDs points sample: '1'; '1,2', 'all'
     * @param options.datebegin {Date|String} - start date of the sample period
     * @param options.dateend {Date|String} - end date of the sample period
     * @param options.groupType {Number} - type grouping when 1 - day, 2 - month, 3 - year
     * @param [options.isAllTime] {Boolean} - if true - does not take into account the working hours
     * @param [isFull] - preparation of financial statistics data of visitors
     * @returns {{promise, resolve, reject}}
     */
    Api.getFinance(options)
      .then(response => console.log('getFullFinance', response))
      .catch(error => console.log('getFullFinance ERROR', error));

    /**
     * Preparation of financial statistics data of visitors
     * @param options {Object} - request params
     * @param options.id {Number|String} - ID of point, or IDs points sample: '1'; '1,2', 'all'
     * @param options.datebegin {Date|String} - start date of the sample period
     * @param options.dateend {Date|String} - end date of the sample period
     * @param options.groupType {Number} - type grouping when 1 - day, 2 - month, 3 - year
     * @param [options.isAllTime] {Boolean} - if true - does not take into account the working hours
     * @returns {{promise, resolve, reject}}
     */
    Api.getFullFinance(options)
      .then(response => console.log('getFullFinance', response))
      .catch(error => console.log('getFullFinance ERROR', error));
  }).catch(error => console.log('ERROR', error));

/**
 * Getting the number of visitors that are on location (point) for the specified time
 * @param options {Object} - request params
 * @param options.id {Number|String} - ID of point, or IDs points sample: '1'; '1,2', 'all'
 * @param options.datetime {Date|String} - date & time of the moment
 * @returns {{promise, resolve, reject}}
 */
Api
  .getVisitorsInMoment({
    id: 'all',
    datetime: '2016-05-06',
  })
  .then(response => console.log('getVisitorsInMoment', response))
  .catch(error => console.log('getVisitorsInMoment ERROR', error));

/**
 * Getting traffic for the period
 * @param options {Object} - request params
 * @param options.id {Number|String} - ID of point, or IDs points sample: '1'; '1,2', 'all'
 * @param options.datebegin {Date|String} - start date of the sample period
 * @param options.dateend {Date|String} - end date of the sample period
 * @param options.groupType {Number} - type grouping when 1 - 15 min, 2 - 1 hour, 3 - 1 day
 * @param [options.isAllTime] {Boolean} - if true - does not take into account the working hours
 * @param [options.UserTz] {Number} - UTC Time Zone (default server time zone). Sample: UserTz=6 equals UTC+6
 * @returns {{promise, resolve, reject}}
 */
Api
  .getTraffic({
    id: 'all',
    datebegin: '2016-01-01',
    dateend: '2017-01-01',
    groupType: 3,
    isAllTime: true,
    UserTz: 3,
  })
  .then(response => console.log('getTraffic', response))
  .catch(error => console.log('getTraffic ERROR', error));

/**
 * Obtaining data for SIM-report for the period
 * @param options {Object} - request params
 * @param options.id {Number|String} - ID of point, or IDs points sample: '1'; '1,2', 'all'
 * @param options.datebegin {Date|String} - the date of the first week (month)
 * @param options.dateend {Date|String} - the date of the second week (month)
 * @param [options.isByWeek] {Boolean} - group by week (default by month)
 * @returns {{promise, resolve, reject}}
 */
Api
  .getSIMReport({
    id: 'all',
    datebegin: '2016-06-05',
    dateend: '2016-06-19',
    isByWeek: false,
  })
  .then(response => console.log('getSIMReport', response))
  .catch(error => console.log('getSIMReport ERROR', error));