API Information
At this time, there are no rate limits. Values are cached for 5 minutes at a time. So, values may be up to 5 minutes old for repeated queries.
You can retrieve the counts from a JSON and JSONP API:
HTTP Endpoint: http://api.sharedcount.com/
HTTPS Endpoint: https://sharedcount.appspot.com/
Parameters
- url: The URL of the page, including http, and www., if applicable. At this time, we do not provide canonicalization services. URL Encode to minimize errors.
- callback (optional): define a callback function for JSONP
Sources
We retrieve the data from the official 'Share' buttons provided by these major services. All of the services provide a JSON API for accessing the shared counts for particular URLs.
- Facebook*: http://api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls=%%URL%%&format=json
- Twitter: http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
- Google Buzz: http://www.google.com/buzz/api/buzzThis/buzzCounter?url=%%URL%%
- LinkedIn: http://www.linkedin.com/cws/share-count?url=%%URL%%
- Digg: http://widgets.digg.com/buttons/count?url=%%URL%%
- Delicious: http://feeds.delicious.com/v2/json/urlinfo/data?url=%%URL%%
- StumbleUpon: http://www.stumbleupon.com/services/1.01/badge.getinfo?url=%%URL%%
- Google +1
+1 counts are retrieved via a JSON-RPC POST call.
POST URL:
https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ
POST Body:
Sample Code - PHP 5+
<?php
$url = ((!empty($_SERVER['HTTPS'])) ? "https://": "http://" ) . $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$json = file_get_contents("http://api.sharedcount.com/?url=" . rawurlencode($url));
$counts = json_decode($json, true);
echo "This page has " . $counts["Twitter"] ." tweets, " . $counts["Facebook"]["like_count"] . " likes, and ". $counts["GooglePlusOne"] . "+1's";
?>