woo.ly
Developer Info
Hello there fellow developer, below are some simple examples of what the API can do. For better documention, visit the Wooly Google Code page.
Simple API request:
This shows an incredibly simple json request to sheer a url. In this example, the domain woo.ly is used and is configured to allow public usages.
http://api.woolyapp.com/url/shear?format=json&domain=woo.ly&url=http://cuteoverload.com
Using JSONP and Jquery to create dynamic "Tweet this" buttons.
This example demonstrates how to utilize Wooly's public URL creation feature. When a domain is configured to allow public usage, anyone can create urls on that domain.
Using the Jquery, you can easily create buttons that will both shorten a url and post it to Twitter. Try it out by clicking the button below.
<!-- The Tweet this button -->
<a class='tweetthis'>Tweet this!</a>
<!-- Styling the button -->
<style>
a.tweetthis {
border: 1px solid #90C4F4;
background-color: #A0F4F4;
padding: 4px;
font-size: .8em;
font-weigth: bold;
-moz-border-radius-bottomleft:4px;
-moz-border-radius-bottomright:4px;
-moz-border-radius-topleft:4px;
-moz-border-radius-topright:4px;
}
a.tweetthis:hover {
background-color: #F0F4F4;
text-decoration: none;
}
</style>
<!-- The jQuery jsonp request --->
<script language='javascript'>
$(function() {
$('a.tweetthis').click(function(){
//Change this to whatever your account is
var account = "woo.ly";
$.getJSON("http://api.woolyapp.com/url/shear?format=json&domain=" + account + "&url=" +
escape(window.location) + "&jsoncallback=?",
function(data){
window.location = 'http://twitter.com/home?status=' + escape(data.mini_url);
});
});
return false;
});
</script>
In a production environment, it is suggested you restrict public to a specfic domain.