bitly_LinksShorten: Given a long URL, returns a short link.

Description Usage Arguments Value Note Examples

View source: R/bitly_links.R


See and


bitly_LinksShorten(longUrl, domain = NULL, showRequestURL = FALSE)



- a long URL to be shortened (example:


- (optional) the short domain to use; either,, or or a custom short domain. The default for this parameter is the short domain selected by each user in their bitly account settings. Passing a specific domain via this parameter will override the default settings.


- show URL which has been build and requested from server. For debug purposes.


new_hash - designates if this is the first time this long_url was shortened by this user. The return value will equal 1 the first time a long_url is shortened. It will also then be added to the user history.

hash - a bitly identifier for long_url which is unique to the given account.

long_url - an echo back of the longUrl request parameter. This may not always be equal to the URL requested, as some URL normalization may occur (e.g., due to encoding differences, or case differences in the domain). This long_url will always be functionally identical the the request parameter.

global_hash - a bitly identifier for long_url which can be used to track aggregate stats across all Bitlinks that point to the same long_url.

url - the actual Bitlink that should be used, and is a unique value for the given Bitly account.


Look in the vignette for bulk shortening of URLs. Each call of this function == 1 API call. Take that into consideration due to limits etc.

The bitly API does not support shortening more than one long URL with a single API call. Meaning 1 Long URL = 1 Function call.

Long URLs should be URL-encoded. You can not include a longUrl in the request that has &, ?, #, or other reserved parameters without first encoding it.

The default value for the domain parameter is selected by each user from within their bitly account settings at

Long URLs should not contain spaces: any longUrl with spaces will be rejected. All spaces should be either percent encoded spaces are all indications of errors. Please remember to strip leading and trailing whitespace from any user input before shortening.


## Not run: 
bitly_token <- bitly_auth(key = "be03aead58f23bc1aee6e1d7b7a1d99d62f0ede8", 
secret = "b7e4abaf8b26ec4daa92b1e64502736f5cd78899")
bitly_LinksShorten(longUrl = "")
bitly_LinksShorten(longUrl = "",domain = "")

## End(Not run)

urlshorteneR documentation built on May 29, 2017, 3:48 p.m.