hashapi-lib-node
Tierion Hash API client library for Node.js
Installation
$ npm install --save hashapi-lib-node
Authenticate
You may either create a HashClient object with token values you've already received, or you may authenticate using your Tierion credentials. In both cases, tokens will refresh automatically when they expire.
To use token values you have already received to create a HashClient object:
var hashclient = ; var access_token = 'your_access_token_here';var refresh_token = 'your_refresh_token_here';var hashClient = access_token refresh_token;
To create a HashClient object and authenticate with your Tierion username and password:
var hashclient = ; var username = 'your_username_here';var password = 'your_password_here';var hashClient = ; hashClient;
Once authenticated, you may choose to manually refresh your access token instead of waiting for the client to auto refresh.
hashClient;
Usage
This library contains a function for each Tierion Hash API endpoint. Each function will return the JSON result for each endpoint as defined in the Hash API documentation at https://tierion.com/docs/hashapi.
HashItems
hashClient;
Receipts
hashClient;
BlockSubscriptions
hashClient;
hashClient;
// parameters variable is an object with up to two elements ->// callbackUrl - REQUIRED - Your url endpoint for the block subscription callback// label - OPTIONAL - Label used for your own referencehashClient;
// parameters variable is an object with up to two elements ->// callbackUrl - OPTIONAL - Set to update callbackUrl value// label - OPTIONAL - Set to update label valuehashClient;
hashClient;