This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Data in Bitly
Overview
The following operations allow you to work with data. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with data, see Sample configuration.
Operation | Description |
---|---|
Returns metadata about a single bitly link. | |
getLinkContent | Returns the “main article” from the linked page. |
getLinkCatagory | Returns the detected categories for a document. |
getHighvalue | Search links receiving clicks across bitly by content. |
getSearch | Get popular bitly links at this particular moment. |
Operation details
This section provides further details on the operations related to data.
Get metadata about a single bitly link
The
getLinkInfo
operation returns metadata about a single Bitly link.
<bitly.getLinkInfo> <bitlyLink>{$ctx:bitlyLink}</bitlyLink> </bitly.getLinkInfo>
Properties
link:
a bitly link
Sample request
Following is a sample REST/JSON request that can be handled by the getLinkInfo
operation.
{ "bitlyLink":"http://bit.ly/1pigQqW" }
Related Bitly documentation
http://dev.bitly.com/data_apis.html#v3_link_info
Get the “main article” from the linked page.
The getLinkContent
operation returns the “main article” from the linked page .
<bitly.getLinkContent> <bitlyLinkforContent>{$ctx:bitlyLinkforContent}</bitlyLinkforContent> <contentType>{$ctx:contentType}</contentType> </bitly.getLinkContent>
Properties
bitlyLinkforContent
: a bitly link
content_type:
specifies whether to return the content as html or plain text
Sample request
Following is a sample REST/JSON request that can be handled by the getLinkContent
operation.
{ "bitlyLinkforContent":"http%3A%2F%2Fbit.ly%2F1pigQqW", "contentType":"html" }
Related Bitly documentation
http://dev.bitly.com/data_apis.html#v3_link_content
Search links receiving clicks across bitly by content
The
getHighvalue
operation returns the “main article” from the linked page .
<bitly.getHighvalue> <NoOfLinks>{$ctx:NoOfLinks}</NoOfLinks> </bitly.getHighvalue>
Properties
NoOfLinks: the maximum number of high-value links to return.
Sample request
Following is a sample REST/JSON request that can be handled by the
getHighvalue
operation.
{ "NoOfLinks":"2" }
Related Bitly documentation
http://dev.bitly.com/data_apis.html#v3_highvalue
Search links receiving clicks across bitly by content
The
getSearch
operation Getting popular bitly links at this particular moment .
<bitly.getSearch> <query>{$ctx:query}</query> <noOfLinks>{$ctx:noOfLinks}</noOfLinks> <fields>{$ctx:fields}</fields> <domain>{$ctx:domain}</domain> </bitly.getSearch>
Properties
query: String to query for.
nooflinks: The maximum number of links to return.
fields: which fields to return in the response (comma-separated).
offset: which result to start with (defaults to 0).
Sample request
Following is a sample REST/JSON request that can be handled by the
getSearch
operation.
{ "query":"flower", "noOfLinks":"2", "fields":"aggregate_link%2Ctitle%2Curl", "domain":"flower" }
Related Bitly documentation
http://dev.bitly.com/data_apis.html#v3_search
Sample configuration
Following is a sample proxy service that illustrates how to connect to Bitly with the init
operation and use the getLinkInfo
operation. The sample request for this proxy can be found in getLinkInfo sample request.
<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.getLinkInfo> <bitlyLink>{$ctx:bitlyLink}</bitlyLink> </bitly.getLinkInfo> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>