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

Description Usage Arguments Value Note Examples

View source: R/bitly_links.R

Description

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

Usage

1
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.

Note

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 https://bitly.com/a/settings/advanced.

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.

Examples

1
2
3
4
5
6
7
## 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")

## End(Not run)

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