About

Philosophy

Memair organises users data into a specific and perscribed format. The intent behind perscribed inputs is to make it easier to produce consistant data. Analysis is easier with consistant data.

Deprecation Policy

Memair adheres to a deprecation schedule however, any endpoint or data structure may be changed or deprecated if there is a security issue. Currently the whole site is in Alpha.
Alpha endpoints
Alpha endpoints are in active development and will likely change or become deprecated.
Beta endpoints
Beta endpoints are being tested more widely with beta users and are unlikely to change. Any non backward compatible changes or deprecation will have at least 4 weeks notice.
Gamma endpoints
Gamma endpoints have been throughly tested. Any non backward compatible changes or deprecation will have at least 6 months notice.

Notices

Notices for changes will be made here.

Bug Beer Bounty 🐞🍺⚓

Find a Bug and I'll buy you a beer 🍻.

API Rate Limits

There are no hard set API limits while this project is in Alpha. Out of courtesy please limit api requests to;
  • one request per second for regular endpoints
  • batch sizes below 2000 with one request per minutes for bulk endpoints
We would also apprecaite feedback on system performance.

Authorization

Create Your Own Access Token

Click here to generate a temporary access token for the currently logged in user. This access token is temporary (10 days). Create an OAuth Application for production apps.

Create an App

Create OAuth Application

Developer Tools > API Keys > New Application (or click here)

Scopes

Read and write scopes are avaliable for all data endpoints. The naming convention for each scope is endpoint_read and endpoint_write. For instance location_read.

Requesting Authorization

Send user to;
https://memair.herokuapp.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=http://redirect.com&response_type=code&scope=location_read+location_write

Requesting Access Token

To request the access token, you should use the returned code and exchange it for an access token.
curl -F grant_type=authorization_code \
  -F client_id=YOUR_CLIENT_ID \
  -F client_secret=YOUR_CLIENT_SECRET \
  -F code=USERS_CODE \
  -F redirect_uri=http://redirect.com \
  -X POST https://memair.herokuapp.com/oauth/token
The response will be
{
  'access_token': 'de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54',
  'token_type': 'bearer',
  'created_at': 1457567765
}

Endpoints

Biometrics

The biometric endpoint stores types and intensity of predefined biometrics. Please contact us to get additional biometric types added.

Get Biometric Measures

No authorisation is required for the biometric_measures endpoint.
curl -X GET https://memair.herokuapp.com/api/v1/biometric_measures

Get Biometrics

curl \
  -F access_token=YOUR_ACCESS_TOKEN \
  -F page=1 \
  -F per_page=100 \
  -X GET https://memair.herokuapp.com/api/v1/biometrics
notes:
  • page will default to 1 if not provided
  • per_page will default to 1000 if not provided

Create Biometrics

Biometric data posted to this end point in a single post have the same timestamp (either provided or deduced).

Inputs

at least one of the following
  • body weight
  • systolic pressure
  • diastolic pressure
  • internal body temperature
  • optional inputs
  • Timestamp (will default to now if not specific)
  • Source
  • Notes
  • curl \
      -F 'weight=0.9' \
      -F 'internal_body_temp=3.6' \
      -F 'timestamp=2015-01-01 00:00:00' \
      -F access_token=YOUR_ACCESS_TOKEN \
      -X POST https://memair.herokuapp.com/api/v1/biometrics

    Emotions

    The emotion endpoint stores types and intensity of predefined emotions. Please contact us to get additional emotion types added.

    Get Emotion Types

    No authorisation is required for the emotion_types endpoint.
    curl -X GET https://memair.herokuapp.com/api/v1/emotion_types

    Get Emotions

    curl \
      -F access_token=YOUR_ACCESS_TOKEN \
      -F page=1 \
      -F per_page=100 \
      -X GET https://memair.herokuapp.com/api/v1/emotions
    notes:
    • page will default to 1 if not provided
    • per_page will default to 1000 if not provided

    Create Emotions

    Biometric data posted to this end point in a single post have the same timestamp (either provided or deduced).

    Inputs

    at least one of the following
  • happy
  • relieved
  • neutral
  • worried
  • sad
  • content
  • angry
  • tired
  • anxious
  • sleepy
  • confounded
  • fearful
  • anguish
  • optional inputs
  • Timestamp (will default to now if not specific)
  • Source
  • Notes
  • curl \
      -F 'happy=4.4' \
      -F 'anguish=5.1' \
      -F 'timestamp=2015-01-01 00:00:00' \
      -F access_token=YOUR_ACCESS_TOKEN \
      -X POST https://memair.herokuapp.com/api/v1/emotions

    Locations

    Get All Locations

    Bash Example

    curl \
      -F access_token=YOUR_ACCESS_TOKEN \
      -F page=1 \
      -F per_page=100 \
      -X GET https://memair.herokuapp.com/api/v1/locations
    notes:
    • page will default to 1 if not provided
    • per_page will default to 1000 if not provided

    Get Locations Within Distance

    Bash Example

    curl \
      -F access_token=YOUR_ACCESS_TOKEN \
      -F lat=42.0 \
      -F long=42.0 \
      -F distance=1000 \
      -F page=1 \
      -X GET https://memair.herokuapp.com/api/v1/locations
    note: page will default to 1 if not provided. lat, long, and distance will be ignored if they are not valid numbers.

    Get Most Recent Location

    To get the most recent location, ping the locations endpoint with a per_page value of 1. Results are ordered decending by timestamp.

    Bash Example

    curl \
    -F access_token=YOUR_ACCESS_TOKEN \
    -F per_page=1 \
    -X GET https://memair.herokuapp.com/api/v1/locations

    Example Response

    {"user":{"id":1,"email":"mr.kittens@gmeow.com"},"locations":[{"id":6239888,"lat":65.390826,"lon":-73.733761,"altitude":0.0,"point_accuracy":30.0,"altitude_accuracy":null,"speed":0.0,"heading":null,"user_id":1,"created_at":"2016-09-22T01:24:14.160Z","updated_at":"2016-09-22T01:24:14.160Z","timestamp":"2016-09-22T01:24:13.000Z","source":null,"url":"https://memair.herokuapp.com/locations/6239888","application":"App"}],"details":{"current_page":1,"total_pages":1564,"next_page":2,"last_page":false}}

    Create Locations

    Inputs

  • Latitude
  • Longitude
  • Timestamp
  • optional inputs
  • Altitude
  • Point accuracy
  • Altitude accuracy
  • Heading
  • Speed
  • Source

  • curl \
      -F latitude=-87.78429035612915 \
      -F longitude=-62.3206518996039 \
      -F 'timestamp=2015-01-01 00:00:00' \
      -F access_token=YOUR_ACCESS_TOKEN \
      -X POST https://memair.herokuapp.com/api/v1/locations

    Create Bulk locations

    See the Google Takeout Location Python script for an example usage for the Bulk Locations endpoint. Post a json array of hashes.

    Inputs

  • Latitude
  • Longitude
  • Timestamp
  • optional inputs
  • Altitude
  • Point accuracy
  • Altitude accuracy
  • Heading
  • Speed
  • Source

  • curl \
      -F 'json=[{"latitude": -87.123, "longitude": -62.123, "timestamp": "2016-05-01 00:00:00", "point_accuracy": 100}]' \
      -F access_token=YOUR_ACCESS_TOKEN \
      -X POST https://memair.herokuapp.com/api/v1/bulk/locations
    The bulk locations endpoint will return a json blob with details of the inniated background process.
    {u'started_at': u'2016-05-04T23:09:03.945Z', u'bulk_import_id': 3639}
    A Bulk Import Status endpoint is incoming.

    Physical Activities

    The physical activity endpoint stores start and end time of predefined activities. Please contact us to get additional activity types added.

    Get Physical Activities Types

    No authorisation is required for the physical_activity_types endpoint.
    curl -X GET https://memair.herokuapp.com/api/v1/physical_activity_types