bothan.js
A node.js client for Bothan, a simple platform for storing and publishing metrics.
Installation
npm install bothan-api
Testing
npm test
Usage
First require the Bothan client:
bothan =
Then initialize a connection with your username, password and the url of your Bothan endpoint:
bothan = user: 'username' pass: 'password' endpoint: 'https://demo.bothan.io'
You will then be able to interact with your Bothan API like so:
Get all metrics
Returns a list of available metrics as an array of objects
bothan
Find a metric
Latest value
Returns the latest value for a specified metric as an object
bothan
For a specific DateTime
Returns the most recent value of a metric at the specified datetime.
bothan
For a specific DateTime range
Returns all values of the metric between the specified times.
bothan
Create a metric
The Bothan API supports four types of metric, all supported by the gem.
simple metric
Create a// Create a metric called 'my-new-metric' with a value of '12' at the current datetimebothan// Create a metric with a specific datetimebothan
metric with a target
Create a// Create a metric called 'my-new-metric' with a value of '1091000', an annual target of '2862000' and a ytd target of '1368000' at the current datetimebothan// Create a metric with a target at a specific datetimebothan// Create a metric without a ytd targetbothan// Create a metric without a ytd target at a specific datetimebothan
metric with multiple values
Create a// Create a metric called 'my-new-metric' with multiple values with the current datetimebothan // Create a metric called 'my-new-metric' with multiple values with a specific datetimebothan
metric with geodata
Create a// Create a geodata metric called 'my-new-metric' with the current datetimebothan // Create a geodata metric called 'my-new-metric' with a specific datetimebothan
Development
After checking out the repo, run npm install
to install dependencies. Then, run npm test
to run the tests.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/theodi/bothan.js. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.