Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

The following operations allow you to work with Links. Click an operation name to see details on how to use it.

...

This section provides further details on the operations related to link.

Anchor
getShorten
getShorten

...

Get a bitly short URL

The getShorten operation Given a long URL,  operation returns a bitly short URL .

Code Block
languagexml
titlegetShorten
<bitly.getShorten>
        <longtUrlforShorten>{$ctx:longtUrlforShorten}</longtUrlforShorten>
        <bitlyShortDomain>{$ctx:bitlyShortDomain}</bitlyShortDomain>
 </bitly.getShorten>
Properties
  • longUrl:A long URL to be shortened
  • domain: (optional) The the short domain to use; either bit.ly, j.mp, or bitly.com or a custom short domain

...

http://dev.bitly.com/links.html#v3_shorten

Anchor
getExpand
getExpand

...

Get the target (long) URL .

The getExpand operation Given a bitly URL or hash (or multiple), returns the target (long) URL .

Code Block
languagexml
titlegetExpand
<bitly.getExpand>
    <shortUrl>{$ctx:shortUrl}</shortUrl>
</bitly.getExpand>
Properties
  • shortUrl: Refers refers to one or more bitly links

...

Related Bitly documentation

http://dev.bitly.com/links.html#v3_expand

...

The getInfo operation Returns returns the page title for a given bitly link .

Code Block
languagexml
titlegetInfo
<bitly.getInfo>        
     <shortUrlforInfo>{$ctx:shortUrlforInfo}</shortUrlforInfo>
     <expandUserinfo>{$ctx:expandUserinfo}</expandUserinfo>            
</bitly.getInfo>
Properties
  • shortUrlforInfo: Refers to one or more bitly links.

  • expandUserinfo: (optional) true| false – include extra user info in response.

...

Following is a sample REST/JSON request that can be handled by the getInfo operation.

Code Block
languagexml
titleSample Request for getInfo
{
"shortUrlforInfo":"http://bbc.in/1ngDL1b",
"expandUserinfo":"true"
}
Related Bitly documentation

http://dev.bitly.com/links.html#v3_info

Anchor
getLinkSave
getLinkSave
Saving a link as a bitmark in a user's history, with optional pre-set metadata

The getLinkSave operation Saves saves a link as a bitmark in a user's history, with optional pre-set metadata .

Code Block
languagexml
titlegetLinkSave
<bitly.getLinkSave>
     <longtUrlforLinkSave>{$ctx:longtUrlforLinkSave}</longtUrlforLinkSave>            
     <titleforLink>{$ctx:titleforLink}</titleforLink>            
     <noteforLink>{$ctx:noteforLink}</noteforLink>             
</bitly.getLinkSave>
Properties
  • longtUrlforLinkSave: String string to query for.

  • titleforLink: (optional) the title of this Bitlink.

  • noteforLink: (optional) a description of, or note about, this Bitlink.

  • private: (optional) boolean true or false indicating privacy setting (defaults to user-level setting).

...

Related Bitly documentation

http://dev.bitly.com/links.html#v3_user_link_save

Anchor
getLookup
getLookup
Query for a bitly link based on a long URL

The getLookup operation query for gets a bitly link  link based on a long URL .

Code Block
languagexml
titlegetLookup
<bitly.getLookup>        
     <urlforLookup>{$ctx:urlforLookup}</urlforLookup>            
</bitly.getLookup>
Properties
  • urlforLookup: An an echo back of the url parameter.

...

Following is a sample REST/JSON request that can be handled by the getLookup operation.

Code Block
languagexml
titleSample Request for getLookup
{
"urlforLookup":"http://google.com/"
}

...

Following is a sample proxy service that illustrates how to connect to Bitly with the init operation and use the getLinkInfo operation getShorten operation. The sample request for this proxy can be found in getLinkInfo getShorten sample request.

Code Block
languagexml
titleSample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="bitly"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
       <inSequence onError="faultHandlerSeq">
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="bitlyLink" expression="json-eval($.bitlyLink)" />
         <bitly.init>
            <accessToken>{$ctx:accessToken}</accessToken>
         </bitly.init>
         <bitly.getInfo>getShorten>        
     		<shortUrlforInfo><longtUrlforShorten>{$ctx:shortUrlforInfolongtUrlforShorten}</shortUrlforInfo>longtUrlforShorten>
     		<expandUserinfo><bitlyShortDomain>{$ctx:expandUserinfobitlyShortDomain}</expandUserinfo>bitlyShortDomain>            
		</bitly.getInfo>getShorten>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>