0.0.1 • Published 7 years ago

experian-node v0.0.1

Weekly downloads
186
License
MIT
Repository
github
Last release
7 years ago

Experian API Node.js Library

The Experian Node library provides convenient access to the REST Experian APIs from applications written in server-side JavaScript.

Please keep in mind that this package is for use with server-side Node that uses Experian client_id, client_secret, username, password and subcode (if applicable).

Documentation

Experian API documentation can be @ Experian

Installation

Install the package with:

npm install experian --save

Usage

The package needs to be configured with your account's client_id, client_secret which is available in your Experan My Apps. Require it with the key's value:

var Experian = require('experian');

//Create instance of Experian API
var myExperianAPI = new Experian(CLIENT_ID,CLIENT_SECRET);
 
//Login Method - Returns a promise
myExperianAPI.login(username,password)
.then((result)=> {
	
   //Make a request to the business - Business Headers API with a BIN and Subcode
	myExperianAPI.business.us.headers({
		subcode:"1234567",
		bin:"1234567"
	})
	.then(function(data) {
		//Success
		console.log(data);
	}, function(error) {
		//Error
		console.error(error);
	});
	
});

Methods

Login

login(username, password)

Get API Field

getApiField(key)

Set Timeout

setTimeout(timeout)

Set API Version

setApiVersion(version)

Set API Key

setApiKey(access_token)

US Business

Search

business.us.search({
  "name":"Experian",
  "street":"475 Anton Blvd",
  "city":"Costa Mesa",
  "state":"CA",
  "zip":"92626",
  "phone":"8772847942",
  "geo":true,
  "subcode":"0563736"
})

Headers

business.us.headers({
  "bin":"807205801",
  "subcode":"0563736"
})
Business Facts
business.us.facts({
  "bin":"722799117",
  "subcode":"0563736"
})
Fraud Shields
business.us.fraudShields({
    "bin":"807205801",
    "subcode":"0563736"
})
Risk Dashboards
business.us.riskDashboards({
  "bin":"700000001",
  "subcode":"0563736"
})
Bankruptcies
business.us.bankruptcies({
  "bin":"404197602",
  "subcode":"0563736",
  "bankruptcySummary":true,
  "bankruptcyDetail":true
})
Scores
business.us.scores({
  "bin":"700000001",
  "subcode":"0563736",
  "commercialScore":true,
  "fsrScore":true
})
Trades
business.us.trades({
  "bin":"700000001",
  "subcode":"0563736",
  "tradePaymentSummary":true,
  "tradePaymentTotals":true,
  "tradePaymentExperiences":true,
  "tradePaymentTrends":true
})
Credit Status
business.us.creditStatus({
  "bin":"700969989",
  "subcode":"0563736"
})
Corporate Linkage
business.us.corporateLinkage({
  "bin":"700513485",
  "subcode":"0563736",
  "corporateLinkagePartial": true,
  "corporateLinkageFull": true
})
Legal Collection Summaries
business.us.legalCollectionSummaries({
    "bin":"700969989",
    "subcode":"0563736",
    "legalFilingsCollectionsSummary":true,
    "legalFilingsSummary":true
})
Liens
business.us.liens({
    "bin":"700969989",
    "subcode":"0563736",
    "lienSummary":true,
    "lienDetail":true
})
Judgements
business.us.judgments({
  "bin":"700969989",
  "subcode":"0563736",
  "judgmentSummary":true,
  "judgmentDetail":true
})
Collections
business.us.collections({
  "bin":"700954701",
  "subcode":"0563736",
  "collectionsSummary":true,
  "collectionsDetail":true
})
UCC Filings
business.us.uccFilings({
    "bin":"700000001",
    "subcode":"0563736",
    "uccFilingsSummary":true,
    "uccFilingsDetail":true
})
Corporate Registrations
business.us.corporateRegistrations({
  "bin":"700000001",
  "subcode":"0563736"
})

Configuring Timeout

Request timeout is configurable (the default is Node's default of 120 seconds):

experian.setTimeout(20000); // in ms (this is 20 seconds)

An example response object

{
    "requestId": "XXXX-XXXX-XXXX-XXXX",
    "success": true,
    "results": [...]
}

error object

{
    "success": false,
    "requestId": "XXXX-XXXX-XXXX-XXXX",
    "errors": [
        {
            "errorCode": XXXX,
            "errorType": "Error Type",
            "message": "Error Message"
        }
    ]
}

Examples

Node.js Express Example

We provided an Express based example of using the Experian Node.js API in the examples/express folder.

Vanilla js Example

We provided an Express based example of using the Experian Node.js API in the examples/vanilla folder.

Development

Run all tests:

$ npm install
$ npm test