Learn R Programming

urlshorteneR (version 0.9.2)

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

Description

See http://dev.bitly.com/rate_limiting.html and http://dev.bitly.com/links.html#v3_shorten

Usage

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

Arguments

longUrl

- a long URL to be shortened (example: http://betaworks.com/).

domain

- (optional) the short domain to use; either bit.ly, j.mp, or bitly.com 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.

showRequestURL

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

Value

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.

Examples

Run this code
# NOT RUN {
bitly_token <- bitly_auth(key = "be03aead58f23bc1aee6e1d7b7a1d99d62f0ede8", 
secret = "b7e4abaf8b26ec4daa92b1e64502736f5cd78899")
bitly_LinksShorten(longUrl = "http://slovnik.seznam.cz/")
bitly_LinksShorten(longUrl = "https://travis-ci.org/dmpe/rbitly/builds/68231423",domain = "j.mp")
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab