Life Expectancy

FREE
By bechllc
Updated 4 months ago
Medical
6.2/10
Popularity Score
32ms
Latency
-
Success Rate

Life Expectancy API Documentation

Returns life expectancy in different formats, such as years left to live and fraction of life completed. Based on US data.

View API Details
time left
POSTTime Left POST
GETTime Left GET
POSTTime Left POST
Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
birthSTRING
REQUIREDDate of birth
Optional Parameters
genderSTRING
OPTIONALGender
Code Snippet
unirest.post("https://life-left.p.rapidapi.com/time-left")
.header("X-RapidAPI-Host", "life-left.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.send("gender=female")
.send("birth=22 April 1977")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://life-left.p.rapidapi.com/time-left
Request Method: POST
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://life-left.p.rapidapi.com/time-left")
.header("X-RapidAPI-Host", "life-left.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.send("gender=female")
.send("birth=22 April 1977")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication