npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

moves-api

v0.0.5

Published

NodeJS wrapper for the Moves.app API

Readme

moves-api

NodeJS module to use the Moves.app API. Currently only authentication and the Storyline endpoint is supported. For more information about the API please refer to the official documentation.

Usage

var movesApi = require('moves-api').MovesApi;
var moves = new movesApi({
    "clientId": "ClientId",
    "clientSecret": "ClientSecret",
    "redirectUri": "RedirectUri",
    "accessToken": "",
    "refreshToken" : "",
});

// Redirect your user to this url
var url = moves.generateAuthUrl();

moves.getAccessToken(code_from_redirect, function(err, authData) {
    moves.options.accessToken = authData.access_token;

    moves.getProfile(function(err, profile) {
        console.log(profile);
    });
});

For more usage examples take a look at the tests or Elizabeth, my script to export your Moves.app data, which uses this module. Surprise!

Methods

MovesApi#generateAuthUrl(scope)

Generates the URL the user needs to visit to start the authentication. scope should be an array of the scopes needed (location, activity)

MovesApi#getAccessToken(code, cb)

If provided with the access code given back from the Moves.app API this will get you the access token, refresh token, and token expiration time to use for the other requests. The callback should be a function(err, authData) {}.

MovesApi#verifyToken(cb)

Verifies the configured access token. The callback should be a function(err) {}.

MovesApi#refreshToken(cb)

If configured with the refresh token, this will request a new access token, refresh token, and token expiration time. The callback should be a function(err, authData) {}.

MovesApi#getProfile(cb)

Returns the profile of the authenticated user. The callback should be a function(err, profile) {}.

MovesApi#getStoryline(options, cb)

Returns storylines! options may just be a string identifying a single day (20130401) or an object to specify a date range or include the trackPoints: { from: "20130401", to: "20130405", trackPoints: false}.

MovesAPI#getSummaries(options, cb)

Returns Daily summaries

Arguments

  • options with the following possible keys:
    • date
    • week
    • month
    • updatedSince
    • pastDays
    • from
    • to
  • callback(err,body)

Example response

[{
   "date": "20130315",
   "summary": [
       {
           "activity": "walking",
           "group": "walking",
           "duration": 2133,
           "distance": 1847,
           "steps": 2500,
           "calories": 60
       },
       {
           "activity": "zumba",
           "duration": 1200,
           "calories": 500
       },
       ...
   ],
   "caloriesIdle": 1785,
   "lastUpdate": "20130317T121143Z"
},
...
]

MovesAPI#getActivities(options, cb)

Returns Daily activities

Arguments

  • options with the following possible keys:
    • date
    • week
    • month
    • updatedSince
    • from
    • to
  • callback(err,body)

Example response:

[
   {
       "date": "20121212",
       "summary": [
           {
               "activity": "walking",
               "group": "walking",
               "duration": 3333,
               "distance": 3333,
               "steps": 3333,
               "calories": 300
           }
       ],
       "segments": [
           {
               "type": "move",
               "startTime": "20121212T071430+0200",
               "endTime": "20121212T074617+0200",
               "activities": [
                   {
                       "activity": "walking",
                       "group": "walking",
                       "manual": false,
                       "startTime": "20121212T071430+0200",
                       "endTime": "20121212T072732+0200",
                       "duration": 782,
                       "distance": 1251,
                       "steps": 1353,
                       "calories": 99
                   },
                   {
                       "activity": "transport",
                       "group": "transport",
                       "manual": false,
                       "startTime": "20121212T072732+0200",
                       "endTime": "20121212T074616+0200",
                       "duration": 1124,
                       "distance": 8443
                   }
               ],
               "lastUpdate": "20130317T121143Z"
           },
           {
               "type": "place",
               "startTime": "20121212T074617+0200",
               "endTime": "20121212T100051+0200",
               "activities": [
                   {
                       "activity": "walking_on_treadmill",
                       "group": "walking",
                       "manual": true,
                       "duration": 270,
                       "steps": 303,
                       "calories": 99
                   }
               ],
               "lastUpdate": "20130317T121143Z"
           },
       ],
       "caloriesIdle": 1785,
       "lastUpdate": "20130317T121143Z"
   },
   {
       "date": "20121213",
       "summary": null,
       "segments": null,
       "caloriesIdle": 1785
   }
]

MovesAPI#getActivitiesList(cb)

Returns Activity List

Lists supported activities. See table of activities for current list.

Arguments

  • callback(err,body)

Example response:

[
   {
       "activity": "aerobics",
       "geo": false,
       "place": true,
       "color": "bc4fff",
       "units": "duration,calories"
   },
   {
       "activity": "badminton",
       "geo": false,
       "place": true,
       "color": "11d1cb",
       "units": "duration,calories"
   },
   ...
]

MovesAPI#getPlaces(options, cb)

Returns Daily places

Arguments

  • options with the following possible keys:
    • date
    • week
    • month
    • updatedSince
    • from
    • to
  • callback(err,body)

Example response:

[
   {
       "date": "20121212",
       "segments": [
           {
               "type": "place",
               "startTime": "20121212T000000+0200",
               "endTime": "20121212T071430+0200",
               "place": {
                   "id": 1,
                   "type": "unknown",
                   "location": {
                       "lat": 55.55555,
                       "lon": 33.33333
                   }
               },
               "lastUpdate": "20130317T121143Z"
           },
           {
               "type": "place",
               "startTime": "20121212T100715+0200",
               "endTime": "20121212T110530+0200",
               "place": {
                   "id": 4,
                   "name": "test",
                   "type": "foursquare",
                   "foursquareId": "4df0fdb17d8ba370a011d24c",
                   "foursquareCategoryIds": ["4bf58dd8d48988d125941735"],
                   "location": {
                       "lat": 55.55555,
                       "lon": 33.33333
                   }
               },
               "lastUpdate": "20130317T121143Z"
           }
   },
   {
       "date": "20121213",
       "segments": null
   }
]

Additional Examples

In the examples directory you can find some additional example uses of the API.

Contribute

Feel free to contribute and add the other API endpoints! :)