GET/v1.1/
Return share counts for a URL.
Endpoint
https://api.sharedcount.com/v1.1/
Parameters
Name | Type | Description | Required |
---|---|---|---|
url | string | The URL you're querying. | true |
apikey | string | Your API Key. | true |
Code Examples
curl 'https://api.sharedcount.com/v1.1?apikey=YOUR_API_KEY&url=https%3A%2F%2Fwww.nytimes.com%2F'
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('https%3A%2F%2Fwww.nytimes.com%2F');
pip install sharedcountsdk
from sharedcountsdk import SharedCountApi
sharedCountApiInstance = SharedCountApi('YOUR_API_KEY')
# Return share counts for a URL.
urlGetResponse = sharedCountApiInstance.get('https%3A%2F%2Fwww.nytimes.com%2F')
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('https%3A%2F%2Fwww.nytimes.com%2F');
URL Encoding Warning
⚠️ Important:
When making API requests, ensure that URL parameters are URL-encoded to pass the correct URL to the social networks.
✅ Good (Encoded): https%3A%2F%2Fwww.nytimes.com%2F%3Fq%3Dtechnology%26sort%3Dnewest
❌ Bad (Unencoded): https://www.nytimes.com/?q=technology&sort=newest
Result Format
{
"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 a number) when a service fails to report a share count.
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.