mPort Mappings API v0.1(beta)

Documentation for all of the mPort's APIs.

Base URLs

Environment Base URL
Sandbox https://sandbox.mport.com/
Live https://mport.com/

In the resources below all the URL are listed as relative URLs. Base URL has to be added to the relative URL to reach the endpoint.


Authentication

OAuth2

Refer to the table for the supported OAuth flows.

Description
OAuth2 Flow Authorization Code
OAuth endpoints
Authorization URL /oauth2/auth
Token URL /oauth2/token

OAuth2 Scopes

Scope Description
member:mapping:measurement:body:read Allows client to retrieve body measurements
member:mapping:measurement:health:read Allows client to retrieve health measurements
offline Allows client to use long lived refresh tokens

Note

Do not implement OAuth2 flow yourself. OAuth is a popular protocol and a proven library exists for your programming language of choice.

For the list of the oauth2 server and client libraries see link.

For more details please refer to the specification: https://tools.ietf.org/html/rfc6749.


Client App Requirements

Client App (Web, Mobile, Server) must satisfy following requirements:

  • App must be reachable via remote network call to complete OAuth flow
  • App must be able to follow HTTP redirects
  • Public app (SPAor Mobile) supports only Authorization Flow with Proof Key for Code Exchange (PKCE)

To register your client please email support@mport.com


GraphQL API

To retrieve member's mapping data use the mPort GraphQL API.

To communicate with the GraphQL API, you'll need an OAuth token with the right scopes.

GraphQL API accepts only POST requests.

To query GraphQL using cURL, make a POST request with a JSON payload:

curl -H "Authorization: bearer token" -X POST -d " \
 { \
   \"query\": \"query { mappings { id }}\" \
 } \
" https://sandbox.mport.com/graphql

Discover the GraphQL API Schema

Graphql Explorer - https://sandbox.mport.com/mappings/introspect

GraphQL Explorer

To use GraphQL Explorer you must provide a valid access token.

You can query __schema to list all types defined in the schema and their details:

query {
  __schema {
    types {
        name
        kind
        description
        fields {
            name
        }
    }
  }
}

Below is the snapshot of some key API types


GraphQL API Types

Mapping

"""
The aggregate of the body measurements and health statistics
produced as a result of 3D body mapping
"""
type Mapping {
  "Unique id of the 3D body mapping"
  id: ID!
  "Time of the occurrence of the 3D body mapping (UTC)"
  time: Time!
  "Collection of body measurements and health statistics"
  measurements: [Measurement!]!
}

Measurement

"""
Measurement represents a body measurement like height, weight, chest circumference, etc
or derived health statistics such as BMI, Body Fat Estimate and others
"""
type Measurement {
  """
  Immutable Name(grouping) of the measurement
  """
  name: MeasurementName!
  """
  Measurement pack: Body, Health
  Measurement can belong to more than one Measurement Pack
  """
  packs: [MeasurementPack!]!
  """
  Measurement value
  """
  values: [MeasurementValueCollection!]!
}

MeasurementValueCollection

"""
Collection of the imperial and metric values of the measurement
"""
type MeasurementValueCollection {
  "Display (user-friendly) label of the measurement "
  label: String!
  "Value of the measurement represented in the metric units"
  metric: MeasurementValue!
  "Value of the measurement represented in the imperial units"
  imperial: MeasurementValue!
}

MeasurementValue

"""
Value (metric or imperial) of the measurement alongside the unit of measure
"""
type MeasurementValue  {
  """
  Value of the measurement
  Type of this field is string as some measurements(health statistics) cannot be represented as a number
  """
  value: String!
  """
  Unit of the measurement: kg, in, cm, etc
  """
  unit: String!
}

REST API

You can also use a conventional REST style API to retrieve member's mappings statistics.

Please refer to OpenAPI spec below.


Warning

You are viewing REST API documentation.

This documentation is auto-generated from a swagger specification which itself is generated from annotations in the source code of the project.

It is possible that this documentation includes bugs and that code samples are incomplete or wrong.


OpenAPI Specification