Metrics API

Part of the Data Mining APIs

 

The Metrics API provides counts of individual user interactions from all monitored social sites around a single post.  One or more fully resolved urls are sent in the request and metrics counts are returned.  These counts will change over time as new metrics are discovered.

 

Two ways to query the API, POST or GET. GET will handle single URL/feed while POST will allow multiple URL/Feeds to be provided. If no feeds are provided there will be no history values returned. POST data will override anything provided on the URL bar.

 

GET Paramemers

 

id MD5 hash of the permalink for the post

 

POST Parameters

 

url[] arrays of MD5 hash values of the permalink to the posts

 

 

Example: GET request of a single post

 

Starting with the fully resolved (pre-resolve urls to bit.ly, tinyurl.com, feedburner etc.) urls compute MD5 and hexencode the bytes to a common text based MD5 hash - this is the id for the story.  You can use the id in the url or a parameter.  For this example start with the post url: http://xkcd.com/530/ and compute the MD5: de3d4d72ebac1e886232f4ab27bd7b46

 

http://api.postrank.com/v2/entry/de3d4d72ebac1e886232f4ab27bd7b46/metrics?appkey=YOUR_APP_KEY

 

Also supported is an alternate format where the id is a url parameter:

 

http://api.postrank.com/v2/entry/metrics?appkey=YOUR_APP_KEY&id=de3d4d72ebac1e886232f4ab27bd7b46

 

Response

  

{

        "de3d4d72ebac1e886232f4ab27bd7b46": {
                "brightkite": 2.0,
                "reddit_votes": 1880.0,
                "delicious": 288.0,
                "reddit_comments": 369.0,
                "views": 9.0,
                "identica": 4.0,
                "google": 40.0,
                "diigo": 2.0,
                "clicks": 58.0,
                "blip": 1.0,
                "digg": 102.0,
                "bookmarks": 4.0,
                "twitter": 911.0,
                "jaiku": 2.0
        }
} 
 

Example: POST multiple story metrics request

 

For better network performance you can POST several post urls at the same time to get back metrics records for each.  POST requests to the following url: http://api.postrank.com/v2/entry/metrics?appkey=YOUR_APP_KEY

 

Request POST body

 

url[]=de3d4d72ebac1e886232f4ab27bd7b46&url[]=a2d4345cbdf68fc92a8934b4a6a49996

 

Response

 

{
        "a2d4345cbdf68fc92a8934b4a6a49996": {
                "reddit_votes": 480.0,
                "delicious": 41.0,
                "reddit_comments": 35.0,
                "views": 7.0,
                "identica": 5.0,
                "diigo": 1.0,
                "tumblr": 9.0,
                "clicks": 30.0,
                "ff_likes": 3.0,
                "bookmarks": 2.0,
                "twitter": 457.0,
                "ff_comments": 7.0
        },
        "de3d4d72ebac1e886232f4ab27bd7b46": {
                "brightkite": 2.0,
                "reddit_votes": 1880.0,
                "delicious": 288.0,
                "reddit_comments": 369.0,
                "views": 9.0,
                "identica": 4.0,
                "google": 40.0,
                "diigo": 2.0,
                "clicks": 58.0,
                "blip": 1.0,
                "digg": 102.0,
                "bookmarks": 4.0,
                "twitter": 911.0,
                "jaiku": 2.0
        }
}

 

 

Command line test:

 

curl -d "url[]=de3d4d72ebac1e886232f4ab27bd7b46&url[]=a2d4345cbdf68fc92a8934b4a6a49996" http://api.postrank.com/v2/entry/metrics?appkey=YOUR_APP_KE

 

Comments (0)

You don't have permission to comment on this page.