This is the API of bitly.com
Installation
Using NPM npm install bitlyapi
Using GIT git clone https://github.com/kishanmadhesiya/bitly.git
Usage
You need 'ACCESS TOKEN' from bitly.com. Visit: https://bitly.com/a/oauth_apps
Check http://dev.bitly.com/ for more info.
Code
import Bitly from 'bitlyapi';
let bitly = new Bitly('<YOUR ACCESS TOKEN>');
bitly.shorten('http://nodejs.org', (response) => {
console.log(response);
}, (error) => {
console.log(error);
});
var Bitly = require('bitlyapi');
var bitly = new Bitly('<YOUR ACCESS TOKEN>');
bitly.shorten('https://github.com/kishanmadhesiya/bitly')
.then(function(response) {
var short_url = response.data.url
}, function(error) {
throw error;
});
Tests
To run tests type npm test
.
For coverage type npm run coverage
Bit.ly Features
This module is limited to the following API methods:
- shorten
- expand
- clicks
- clicks_by_minute
- clicks_by_day
- referrers
- countries
- bitly_pro_domain
- lookup
- info
- history
- link_edit