Skip to content

mbmccormick/api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Personal API

Welcome to the documentation for my Personal API! For more information on how this works, check out my blog post. You can also view the source code on GitHub.

Resources

GET /v0/profile/ - My basic information from Facebook

{
    "name": "Matt McCormick",
    "gender": "male",
    "bithdate": "1990-07-05",
    "location": "Seattle, Washington",
    "hometown": "Oxford, Michigan",
    "relationship_status": "Married",
    "significant_other": "Libby McCormick"
}

GET /v0/profile/education/ - My education history from Facebook

[
    {
        "type": "High School",
        "school": "Lake Orion High School",
        "year": "2008"
    },
    {
        "type": "College",
        "school": "Purdue University",
        "year": "2012"
    },
    ...
]

GET /v0/profile/employment/ - My employment history from Facebook

[
    {
        "position": "Program Manager",
        "employer": "Microsoft",
        "location": "Redmond, Washington",
        "start_date": "2013-02-28"
    },
    {
        "position": "IT Networks & Telecommunications Programmer",
        "employer": "Purdue University",
        "location": "West Lafayette, Indiana",
        "start_date": "2011-08-01",
        "end_date": "2012-12-01"
    },
    ...
]

GET /v0/activity/ - Summary of my recent activity from Fitbit

{
    "steps": {
        "step_goal": 10000,
        "steps": 883
    },
    "sleep": {
        "sleeps": 1,
        "minutes_asleep": 418
    }
}

GET /v0/activity/steps/ - My step activity from Fitbit

[
    {
        "date": "2015-07-17",
        "value": "6470"
    },
    {
        "date": "2015-07-16",
        "value": "10973"
    },
    ...
]

GET /v0/activity/sleep/ - My sleep time (in minutes) from Fitbit

[
    {
        "date": "2015-07-17",
        "value": "426"
    },
    {
        "date": "2015-07-16",
        "value": "427"
    },
    ...
]

GET /v0/activity/workouts/ - My latest workouts (in meters and seconds) from Strava

[
    {
        "dateTime": "2015-07-15T02:07:54.000Z",
        "name": "Burke-Gilman Trail",
        "type": "Run",
        "distance": 8131.2,
        "duration": 2660
    },
    {
        "dateTime": "2015-07-11T23:58:39.000Z",
        "name": "Cheshiahud Lake Union Loop",
        "type": "Run",
        "distance": 14369.9,
        "duration": 4307
    },
    ...
]

GET /v0/body/weight/ - My body weight (in kilograms) from Fitbit

[
    {
        "date": "2015-07-17",
        "value": "64.25"
    },
    {
        "date": "2015-07-16",
        "value": "64.73"
    },
    ...
]

GET /v0/social/ - Summary of my recent activity from Twitter and GitHub

{
    "twitter": {
        "tweets": 7960,
        "followers": 425,
        "following": 653,
        "favorited": 1998
    },
    "github": {
        "followers": 47,
        "following": 54,
        "repos": 92,
        "gists": 98
    }
}

GET /v0/social/twitter/ - My recent tweets from Twitter

[
    {
        "dateTime": "2015-07-16T19:31:13.000Z",
        "text": "@TillamookCheese To whom should I speak about getting my dollar back? :("
    },
    {
        "dateTime": "2015-07-16T19:29:40.000Z",
        "text": "@TillamookCheese Your yogurt machine put an extra label on the INSIDE of my yogurt container... http://t.co/0WeNejrgqP"
    },
    ...
]

GET /v0/social/github/ - My recent activity on GitHub

[
    {
        "dateTime": "2015-07-14T23:19:53.000Z",
        "type": "Watch",
        "repo": "ahmetalpbalkan/personal-dashboard",
        "payload": {
            "action": "started"
        }
    },
    {
        "dateTime": "2015-07-14T17:37:00.000Z",
        "type": "Push",
        "repo": "name": "mbmccormick/fitminder",
        "payload": {
            "push_id": 725624162,
            "size": 1,
            "distinct_size": 1,
            "ref": "refs/heads/master",
            "head": "8164f881c6be08eb0cfe06b779a611a6265861a9",
            "before": "f606629586bb319757f32c0ce253febf98971509",
            "commits": [
                {
                    "sha": "8164f881c6be08eb0cfe06b779a611a6265861a9",
                    "author": {
                        "email": "mbmccormick@outlook.com",
                        "name": "Matt McCormick"
                    },
                    "message": "Update routes.js",
                    "distinct": true,
                    "url": "https://api.github.com/repos/mbmccormick/fitminder/commits/8164f881c6be08eb0cfe06b779a611a6265861a9"
                }
            ]
        }
    },
    ...
]

GET /v0/blog/ - My recent blog posts

[
    {
        "date": "2015-07-09",
        "title": "Fitminder - Fitbit Idle Alert",
        "url": "http://mbmccormick.com/2015/07/fitminder-fitbit-idle-alert"
    },
    {
        "date": "2015-06-10",
        "title": "vso.io - Short URL for Visual Studio Online work items",
        "url": "http://mbmccormick.com/2015/06/vso-io-short-url-for-visual-studio-online-work-items"
    },
    ...
]

GET /v0/driving/ - My driving history (in seconds, meters, and gallons) from Automatic

[
    {
        "dateTime": "2015-07-19T03:38:29.752Z",
        "duration": 689,
        "distance": 7016.8,
        "mpg": 18.89,
        "fuelConsumption": 0.23,
        "hard_brakes": 0,
        "hard_accelerations": 0
    },
    {
        "dateTime": "2015-07-19T01:45:59.606Z",
        "duration": 1652,
        "distance": 18006.5,
        "mpg": 20.44,
        "fuelConsumption": 0.55,
        "hard_brakes": 0,
        "hard_accelerations": 0
    },
    ...
]

Deployment

This Personal API project can be deployed to pretty much any cloud hosting provider that supports node.js web applications. My personal instance is deployed to Heroku. Regardless of which hosting provider you choose, you will need to supply server-side values for the following configuration settings:

AUTOMATIC_ACCESS_TOKEN - Automatic.com Access Token

AUTOMATIC_CONSUMER_KEY - Automatic.com Consumer Key

AUTOMATIC_CONSUMER_SECRET - Automatic.com Consumer Secret

FACEBOOK_ACCESS_TOKEN - Facebook.com Access Token

FITBIT_ACCESS_TOKEN - Fitbit.com Access Token

FITBIT_CLIENT_ID - Fitbit.com Client ID

FITBIT_CLIENT_SECRET - Fitbit.com Client Secret

STRAVA_ACCESS_TOKEN - Strava.com Access Token

TWITTER_ACCESS_TOKEN - Twitter.com Access Token

TWITTER_CONSUMER_KEY - Twitter.com Consumer Key

TWITTER_CONSUMER_SECRET - Twitter.com Consumer Secret

TWITTER_TOKEN_SECRET - Twitter.com Token Secret

And any other configuration settings are defined in the modules in the /app folder of the project.

Availability

For my personal instance of this project, I also have a series of outside-in monitoring tests configured at Runscope. These tests run daily against each of the API methods I have created to ensure that all of the various data sources are properly responding to my application. I'll also receive an email alert if any of the methods begin to fail.

Known Issues

Facebook no longer provides access tokens which do not expire to application developers. Instead, you must first request an access token for your application using the Graph API Explorer and then make a subsequent request to extend the expiry of that access token to the maximum duration of 60 days. This is not ideal, but I have not yet found a way around this limitation. Instead, I rely on the Runscope tests mentioned above to notify me once this token has expired and that it is time to manually renew it.

About

Personal API for Matt McCormick

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published