Getting started with SharedCount API

SharedCount is a social media analytics tool that provides information on how many times a URL has been shared on social media platforms like Facebook, Twitter, Pinterest, LinkedIn, and others. The SharedCount API allows developers to retrieve this kind of information programmatically.

In this blog post, we will walk you through all the steps required to get started with the SharedCount API. We will cover everything from registration to sending requests and parsing responses. We will also provide some JavaScript code snippets, which should give you a good starting point.

So, let's get started!

Step 1: Register for an API key

Before you can start using the SharedCount API, you will need to register for an API key. You can do this by visiting the following URL:

https://www.sharedcount.com/register

Once you have registered, you will receive an email with a link to confirm your account. Click on the link to confirm your account, and then log in to your account.

Once you have logged in, you can access your API key by clicking on the "API" link in the main menu. Your API key should be displayed on the page.

Step 2: Understanding the API endpoints

The SharedCount API provides four endpoints:

  • /v1.0/counts

    This endpoint retrieves the share count data for a given URL.

  • /v1.0/multiple

    This endpoint retrieves the share count data for multiple URLs.

  • /v1.0/bulk

    This endpoint retrieves the share count data for up to 1000 URLs at once.

  • /v1.0/domain

    This endpoint retrieves the share count data for a given domain.

Step 3: Sending requests to the API

To send a request to the SharedCount API, you will need to construct a URL with the appropriate endpoint and parameters. Here is an example URL to retrieve share count data for a single URL:

https://api.sharedcount.com/v1.0/counts?url=https://www.example.com&apikey=YOUR_API_KEY

To retrieve share count data for multiple URLs, you would use the following URL:

https://api.sharedcount.com/v1.0/multiple?urls=https://www.example.com,https://www.anotherexample.com&apikey=YOUR_API_KEY

The parameters are self-explanatory. url parameter is used to specify the URL for which you want the share count data, while urls parameter is used to specify multiple URLs separated by comma.

Step 4: Parsing the API response

The response from the SharedCount API will be in JSON format. Here is an example response for the first URL in the previous request:

{
 "StumbleUpon": 0,
 "Reddit": 3081,
 "GooglePlusOne": 0,
 "Twitter": 6,
 "Pinterest": 0,
 "LinkedIn": 0,
 "Facebook": {
   "commentsbox_count": 0,
   "click_count": 0,
   "total_count": 30,
   "comment_count": 7,
   "like_count": 23,
   "share_count": 0
 },
 "Delicious": 0
}

You can easily parse the JSON response in JavaScript using JSON.parse() function. Here is an example code snippet to parse the response:

let responseJson = JSON.parse(response);
console.log(responseJson.Facebook.total_count);

This code will print the total count of Facebook shares.

Conclusion

In this blog post, we have covered all the basic steps required to get started with the SharedCount API. We have explained how to register for an API key, how to construct API requests, and how to parse the API response. We hope this blog post has given you a good starting point for integrating the SharedCount API into your projects.

Related APIs