Skip to content

Instantly share code, notes, and snippets.

@thesved
Created October 13, 2020 09:41
Show Gist options
  • Save thesved/722d23ccdefa0527c4066b2f86ed238f to your computer and use it in GitHub Desktop.
Save thesved/722d23ccdefa0527c4066b2f86ed238f to your computer and use it in GitHub Desktop.
Oura API JavaScript integration
// 1. create access token https://cloud.ouraring.com/docs/authentication#create-a-personal-access-token
// 2. use API 👍
var OURA_TOKEN = '...';
var date = 'date in `YYYY-MM-DD` format';
var res = await fetch("https://api.ouraring.com/v1/sleep?start="+date+"&end="+date+"&access_token="+OURA_TOKEN);
var data = (await res.json()).sleep;
data = data.length ? data[0] : {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment