botify-sdk v1.0.0-beta5
botify-sdk
This package contains the Javascript SDK for Botify API. API documentation can be found at https://developers.botify.com/api/.
SDK Demo: link
Installation
Node.js, Webpack, Browserify
npm install --save botify-sdk@1.0.0-beta5var BotifySDK = require('botify-sdk');
BotifySDK.authToken(token);
BotifySDK.AnalysisController.getAnalysisSummary({
username: 'foo',
projectSlug: 'bar',
analysisSlug: 'koo',
}, function (err, response) {
// Handle response
});Vanilla javascript
<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>Require.JS (AMD)
<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.
Usage
Authentication
BotifySDK.authToken(token);How to get your token: https://developers.botify.com/api/authentication/
Request API
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
Example
BotifySDK.AnalysisController.getAnalysisSummary({
username: 'foo',
projectSlug: 'bar',
analysisSlug: 'koo',
}, function(error, result) {
// Handle response
});getUrlsAggs
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
Optimization
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.
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago