Data API Overview

๐Ÿ“˜

For a full list of queries, see the API Reference.

What is the Data API?

The Data API is a REST API that provides comprehensive health data served via JSON for request and response payloads. Endpoints of the Data API can be found in the API Reference page.

๐Ÿšง

This section assumes that you have registered users and have retrieved their access tokens using Connect. If you haven't done that yet, please go through the Web Guide section of the documentation.

Querying a User's Health Data

To query a user's health data all you need to do is use their accessToken in a GET request to one of the Human API endpoints. A standard query looks like this:

curl -H "Authorization: Bearer demo" "https://api.humanapi.co/v1/human"

๐Ÿ‘

Demo data

You can always give an endpoint a try with the access_token demo. See Demo Data for more info.

Before you start to write your data retrieval infrastructure you will want to review a few things:

  1. The Patterns and Conventions section, which covers all important conventions Human API follows.

  2. The Demo Data section, which covers how to work with demo data while you prototype and integrate.

  3. The API Reference page, which provides a comprehensive list of all the endpoints the Data API provides.

Setting Up Basic Data Retrieval

Now that you know how to query an individual user's health data, you need to set up your data retrieval infrastructure. An example of a basic data retrieval using Node.js would be:

const fetch = require("node-fetch")

var headers = {
    'Authorization': 'Bearer ' + <access_token>,
    'Accept': 'application/json'
  };
  var url = 'https://api.humanapi.co/v1/human/medical/test_results?limit=1'

  fetch(url,{
    method: 'GET',
    headers : headers,
  })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch((error) => {
    console.error('Error:', error);
});

That's all there is to it! Now that you have implemented Connect and started to retrieve data via the Data API, you can continue building out your application.

Since you have the basics down, you may be interested in learning more about:

Best Practices