Wednesday, May 11, 2016

New API: Snapshot Stats

If you're a Team CI Pro user enjoying the weekly e-mails and stats, and thinking what fun you could have with that raw data (we won't judge), then we've got some fantastic news: we've opened up a new API just for you!

Weekly recap e-mail

This API is basically a list of weekly snapshots of your teams stats.  We originally took these snapshots to get the delta's that are in the e-mails.  But now they're available for you to use and abuse.

API Key


To get started you'll need an API key.  To get it click the new "Get Your API Key" button in the Team CI section of the site.



Then type your password, click the button and copy the resulting API Key.



Hit That API


To get the data POST to http://sirenofshame.com/ApiV1/Snapshots.  To pass your credentials you can use: Content-Type: application/json with

{'UserName': '[YourUsername]','Password': '[YourApiKey]'}

or if you prefer you can use Content-Type: application/x-www-form-urlencoded with

Username=[YourUsername]&Password=[YourApiKey]

In other words:

curl --url http://sirenofshame.com/ApiV1/Snapshots -H "Content-Type:application/x-www-form-urlencoded" -d "UserName=[Username]&Password=[ApiKey]"

The result is hopefully something like:

{
    "Success": true,
    "ErrorMessage": null,
    "Result": [
        {
            "StatSnapshotId": 174,
            "SnapshotDate": "/Date(1428091201543)/",
            "Users": [
                {
                    "DisplayName": "Lee Richardson",
                    "RawName": "leerichardson",
                    "Fseb": 4,
                    "TotalBuilds": 399,
                    "Csb": 0,
                    "FailPercent": 105,
                    "Achievements": 12,
                    "Reputation": 189,
                    "UserId": 782,
                    "UserStatSnapshotId": 2958
                },
                { /* all of your other users should be listed here */ }        
           ]
        },
        /* up to 2 years worth of snapshots should be here */
    ]
}

Summary


Hope you enjoy.  If you do something fun with the data please consider sharing by posting here or shooting us a note on twitter or Facebook.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.