All Projects → Tierion → Hashapi Lib Node

Tierion / Hashapi Lib Node

Licence: apache-2.0
Tierion Hash API client library for Node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Hashapi Lib Node

Datafire
A framework for building integrations and APIs
Stars: ✭ 487 (+2335%)
Mutual labels:  api, api-client
Unifi Api Browser
Tool to browse data exposed by Ubiquiti's UniFi Controller API (demo: https://api-browser-demo.artofwifi.net/)
Stars: ✭ 677 (+3285%)
Mutual labels:  api, api-client
Unifi Api Client
A PHP API client class to interact with Ubiquiti's UniFi Controller API
Stars: ✭ 602 (+2910%)
Mutual labels:  api, api-client
Diplomat
A HTTP Ruby API for Consul
Stars: ✭ 358 (+1690%)
Mutual labels:  api, api-client
Slack
🎉✨ Slack API client for Node and browsers.
Stars: ✭ 903 (+4415%)
Mutual labels:  api, api-client
Node Vault
Client for HashiCorp's Vault
Stars: ✭ 391 (+1855%)
Mutual labels:  api, api-client
Pyowm
A Python wrapper around the OpenWeatherMap web API
Stars: ✭ 654 (+3170%)
Mutual labels:  api, api-client
Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+14415%)
Mutual labels:  api, api-client
Cv4pve Api Java
Proxmox VE Client API JAVA
Stars: ✭ 17 (-15%)
Mutual labels:  api, api-client
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+3880%)
Mutual labels:  api, api-client
Insomnia
The open-source, cross-platform API client for GraphQL, REST, and gRPC.
Stars: ✭ 18,969 (+94745%)
Mutual labels:  api, api-client
Abclinuxuapi
API for http://abclinuxu.cz.
Stars: ✭ 8 (-60%)
Mutual labels:  api, api-client
Merkle Patricia Tree
Project is in active development and has been moved to the EthereumJS VM monorepo.
Stars: ✭ 277 (+1285%)
Mutual labels:  merkle-tree, proof
Chronicle
Public append-only ledger microservice built with Slim Framework
Stars: ✭ 429 (+2045%)
Mutual labels:  hash, proof
Hubspot Php
HubSpot PHP API Client
Stars: ✭ 273 (+1265%)
Mutual labels:  api, api-client
Client
DigitalOcean API v2 client for PHP
Stars: ✭ 604 (+2920%)
Mutual labels:  api, api-client
pymerkletools
Python tools for creating Merkle trees, generating Merkle proofs, and verification of Merkle proofs
Stars: ✭ 128 (+540%)
Mutual labels:  hash, merkle-tree
Pymisp
Python library using the MISP Rest API
Stars: ✭ 254 (+1170%)
Mutual labels:  api, api-client
Client
GitLab API v4 client for PHP
Stars: ✭ 763 (+3715%)
Mutual labels:  api, api-client
Cortex4py
Python API Client for Cortex
Stars: ✭ 22 (+10%)
Mutual labels:  api, api-client

hashapi-lib-node

npm npm

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 = require('hashapi-lib-node');

var access_token = 'your_access_token_here';
var refresh_token = 'your_refresh_token_here';
var hashClient = new hashclient(access_token, refresh_token);

To create a HashClient object and authenticate with your Tierion username and password:

var hashclient = require('hashapi-lib-node');

var username = 'your_username_here';
var password = 'your_password_here';
var hashClient = new hashclient();

hashClient.authenticate(username, password, function(err, authToken){
    if(err) {
        // handle the error
    } else {
        // authentication was successful
        // access_token, refresh_token are returned in authToken
        // authToken values are saved internally and managed autmatically for the life of the HashClient 
    }
});

Once authenticated, you may choose to manually refresh your access token instead of waiting for the client to auto refresh.

hashClient.refreshAuthToken(function(err, authToken){
    if(err) {
        // handle the error
    } else {
        // refresh was successful
    }
});

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.submitHashItem(hash, function(err, result){
    if(err) {
        // handle the error
    } else {
        // process result
    }
});

####Receipts

hashClient.getReceipt(id, function(err, result){
    if(err) {
        // handle the error
    } else {
        // process result
    }
});

####BlockSubscriptions

hashClient.getAllBlockSubscriptions(function(err, result){
    if(err) {
        // handle the error
    } else {
        // process result
    }
});
hashClient.getBlockSubscription(id, function(err, result){
    if(err) {
        // handle the error
    } else {
        // process result
    }
});
// 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 reference
hashClient.createBlockSubscription(parameters, function(err, result){
    if(err) {
        // handle the error
    } else {
        // process result
    }
});
// parameters variable is an object with up to two elements ->
// callbackUrl - OPTIONAL - Set to update callbackUrl value
// label - OPTIONAL - Set to update label value
hashClient.updateBlockSubscription(id, parameters, function(err, result){
    if(err) {
        // handle the error
    } else {
        // process result
    }
});
hashClient.deleteBlockSubscription(id, function(err, result){
    if(err) {
        // handle the error
    } else {
        // process result
    }
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].