Tutorial for urlshorteneR – v4

dmpe @ github


urlshorteneR wraps 2 URL services Bit.ly and its 2 friends is.gd as well as v.gd. For Bit.ly, in order to shorten URLs and downloading useful statistics about them, you have to authenticate using OAuth2.0 protocol, for which you need user account and API keys..

For 2 other services is.gd & v.gd, there is no authentication needed. Just create desired short links, see below.


User/App Information & Authentication for Bit.ly

Return some basic information about my user on Bit.ly. Additionally, is my account a “premium” one?

## In order to use bitly functions, you first need to authenticate.
##                         For that execute 'bitly_auth()' in R console.
if(interactive()) {
# You must register a new pair of keys yourself
# bitly_token <- bitly_auth(key = "xxx", secret = "xxx")
# bitly_token <- bitly_auth()

  ui <- bitly_user_info(showRequestURL = TRUE)

We can also decide to update my username with a different one.

if (interactive()) {
bitly_update_user(name = "John Malc", showRequestURL = TRUE)

And what about the metadata about our OAUTH application?

if (interactive()) {

Group Information

This retrieves information about a single group that user belongs to and and then about all groups that user are associated with.

if (interactive()) {


Information about Organizations

Official API documentation https://dev.bitly.com/api-reference.

The first method returns an information about myself.

if (interactive()) {

Is.gd & V.gd


isgd_LinksShorten(longUrl = "https://us.cnn.com", showRequestURL = TRUE)
## The requested URL has been this:  https://is.gd/create.php?format=json&url=https%3A%2F%2Fus.cnn.com&logstats=0
## [1] "https://is.gd/w56Qbw"


vgd_LinksShorten(longUrl = "https://www.cbs.com", showRequestURL = TRUE)
## The requested URL has been this:  https://v.gd/create.php?format=json&url=https%3A%2F%2Fwww.cbs.com&logstats=0
## [1] "https://v.gd/K6VQiT"