API Docs

Version:  1.1

GET/v1.1/

Return share counts for a URL.


Definition

https://api.sharedcount.com/v1.1/


Parameters

No User

NameTypeDescription Required
urlstringThe URL you're querying.true
apikeystringYour API Key.true
callbackstringFor JSONP, the callback function name.false
custom_ttlintegerNumber of seconds you'd like the results to be cached. (Available only on the Dedicated Plan).false

Curl
Node.js
Python
Php
curl 'https://api.sharedcount.com/v1.1?apikey=YOUR_API_KEY&url=https://www.nytimes.com/'
npm i sharedcount-sdk

const SharedCountApi = require('sharedcount-sdk');
let sharedCountApiInstance = new SharedCountApi('YOUR_API_KEY');

//Return share counts for a URL.
var urlGetResponse = sharedCountApiInstance.get(url);
pip install sharedcountsdk

from sharedcountsdk import SharedCountApi
sharedCountApiInstance = SharedCountApi('YOUR_API_KEY')
 
# Return share counts for a URL.
var urlGetResponse = sharedCountApiInstance.get(url)
 
composer require sharedcount/sharedcount-sdk

require __DIR__ . '/vendor/sharedcount/sharedcount-sdk/lib/api.php';
$sharedcountApiInstance = new SharedcountApi('YOUR_API_KEY');
 
//Return share counts for a URL.
$urlGetResponse = $sharedcountApiInstance->bulkGet($url);
 

Result Format

Success
Failure
{"Pinterest":9,"Facebook":{"total_count":168,"comment_count":53,
"reaction_count":14,"share_count":101,"comment_plugin_count":0}}
{"Error": "Error message here", "Type": "error_type"}

Documentation

This endpoint returns null (instead of 0) when a service fails to report a number. It removes values from the responses that SharedCount no longer queries, like Buzz, Reddit and Delicious.

Generally speaking, it does not guarantee the presence of particular network's data in every response, which may be removed without notice. (For example, Buzz is still shown in normal API responses, despite not existing for several years).

This means that usage of this API requires ensuring that the particular attribute you're accessing is available on the object, and handling null values for when it is available.

Custom Cache Times

Users on Dedicated Plans may specify a custom cache time for a given URL by passingcustom_ttlas a parameter with a non-negative integer representing the number of seconds you'd like the value to be cached. The default is 1200, which corresponds to 20 minutes.

To disable any kind of caching, setcustom_ttlto0.

By settingcustom_ttl, you have the effect of altering theExpiresandCache-Controlheader, as well as configuring how long the application itself will cache the data for that URL.

Setting thecustom_ttlparameter only affects subsequent requests for that given URL. If previous requests for that URL set a differentcustom_ttlvalue, those original values may continue to be respected.