This package contains the Javascript SDK for Botify API. API documentation can be found at https://developers.botify.com/api/.
SDK Demo: link
npm install --save botify-sdk@1.0.0-beta5
var BotifySDK = require('botify-sdk');
BotifySDK.authToken(token);
BotifySDK.AnalysisController.getAnalysisSummary({
username: 'foo',
projectSlug: 'bar',
analysisSlug: 'koo',
}, function (err, response) {
// Handle response
});
<script src="https://cdn.jsdelivr.net/botify/1.0.0-beta5/botify-sdk.min.js"></script>
<script>
BotifySDK.authToken(token);
BotifySDK.AnalysisController.getAnalysisSummary({
username: 'foo',
projectSlug: 'bar',
analysisSlug: 'koo',
}, function (err, response) {
// Handle response
});
</script>
<script src="https://cdn.jsdelivr.net/botify/1.0.0-beta5/botify-sdk.min.js"></script>
<script>
define(["BotifySDK"], function(BotifySDK) {
BotifySDK.authToken(token);
BotifySDK.AnalysisController.getAnalysisSummary({
username: 'foo',
projectSlug: 'bar',
analysisSlug: 'koo',
}, function (err, response) {
// Handle response
});
});
</script>
Note: If you'd like to host the lib yourself, the bundle is available at dist/botify-sdk.min.js
in the npm module.
BotifySDK.authToken(token);
How to get your token: https://developers.botify.com/api/authentication/
The SDK exposes a function for each operation. They comply with the following signature:
BotifySDK.Controller.operation(params, callback);
params
(object): params are documented both in the SDK code or in the API documentation (becareful that in the JS SDK params are camelcased).callback
(function): NodeJS compliant callback.
Full list of operations at https://developers.botify.com/api/reference
BotifySDK.AnalysisController.getAnalysisSummary({
username: 'foo',
projectSlug: 'bar',
analysisSlug: 'koo',
}, function(error, result) {
// Handle response
});
SDK exposes Query
and QueryAggregate
models that can be used as input for Analysis.getUrlsAggs
to make this complex endpoint a lot easier to deal with. More information
Example of Query usage in the demo
Middlewares are avalaible in the package botify-sdk-middlewares. Consider using them for optimization and rate limit leverage. Some have been included by default in this package.