npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

reachmailapi

0.2.4 • Public • Published

ReachMail API client library for node.js

reachmailnj aims to provide a simple client library for interacing with the ReachMail API.

Requirements

Getting started

This wrapper provides a number of convenience functions for working with various API services. Each convenience function is named after the section and service it accesses, e.g. administrationAddresses() accesses /administration/addresses. Convenience functions will require at least a callback function and in most cases, parameters representing your account information and service request details. A complete list of the convenience functions is included below.

Alternatively, the basic functions for 'GET', 'POST', 'PUT', and 'DELETE' have been provided if you would like to access the services directly. Refer to the "Function parameters" section below for an example. Documentation on the required parameters for each service can be found in the ReachMail API documentation.

Note that at this time the client library supports only token authentication. For more information, refer to these instructions on creating a token.

Installing the wrapper

To install the wrapper via npm:

    $mkdir MyApplication
    $cd MyApplication
    $npm install reachmailapi

Or clone the full repository and copy the NodeJS wrapper to your application directory:

    $git clone git@github.com:ReachmailInc/WebAPISamples.git
    $mkdir MyApplication
    $cp WebAPISamples/nodejs/reachmailapi.js MyApplication

Configuring the API

    var reachmail = require('reachmailapi');

    var api = new reachmail({token: 'your_token_here'});

Base Functions:

  • get(serviceUrl, callback())

      api.get('/administration/users/current', 
              function (httpCode, response) {
        console.log(httpCode);
        console.log(response);
      });
    
  • post(serviceUrl, postBody, callback())

      api.post('/lists/filtered/00000000-0000-0000-0000-000000000000',
              {'LargerThan': 500}, function (httpCode, response) {
        console.log(httpCode);
        console.log(response);
      });
    
  • put(serviceUrl, postBody, callback())

      api.put('/lists/00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000',
              {'Name': 'New list name'}, function (httpCode, response) {
        console.log(httpCode);
        console.log(response);
      });
    
  • delete(serviceUrl, callback())

      api.delete('lists/00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000',
                  function (httpCode, response) {
        console.log(httpCode);
        console.log(response);
      });
    

Convenience Functions

All convenience functions are listed here along with their required parameters, each one is linked to it's corresponding service documentation.

Questions regarding use of this software should be referred to support@reachmail.com

Keywords

install

npm i reachmailapi

Downloadsweekly downloads

19

version

0.2.4

license

none

homepage

github.com

last publish

collaborators

  • avatar
Report a vulnerability