Natural Language for Exercise
  • 1 Minute to read
  • Dark
    Light

Natural Language for Exercise

  • Dark
    Light

Article summary

Use this API to estimate calories burned for various exercises using natural language. Developer can optionally include user demographics like age, gender, weight to make a more accurate estimate for calories burned.

Resource Information

Add the resource information as follows:

Resource InformationValue
Response FormatJSON
Requires AuthenticationYes
HTTP MethodPOST
Host Domainhttps://trackapi.nutritionix.com
Endpoint/v2/natural/exercise

Header

The header of the request contains parameters to authenticate the request. The request is authenticated only if the API authentication is enabled for you.

To authenticate the request, you must pass the “x-app-id” and “x-app-key”. For more information, see Understand Request Headers.

Parameters

Expand to see the parameters and description


NameRequiredDescriptionExample

query

string

YesQuery to be executed against.
“I ran 1 mile”

weight_kg

number

NoWeight55

height_cm

number

NoHeight167.64

age

number

NoAge in years60

Request

In the request, send the following details:


var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://trackapi.nutritionix.com/v2/natural/exercise',
  'headers': {
    'Content-Type': 'application/json',
    'x-app-id': ,
    'x-app-key': 
  },
  body: JSON.stringify({
    "query": "swam for 1 hour"
  })

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Response

Returns in JSON format.


{
    "exercises": [
        {
            "tag_id": 63,
            "user_input": "swam",
            "duration_min": 60,
            "met": 6,
            "nf_calories": 420,
            "photo": {
                "highres": "https://d2xdmhkmkbyw75.cloudfront.net/exercise//63_highres.jpg",
                "thumb": "https://d2xdmhkmkbyw75.cloudfront.net/exercise//63_thumb.jpg",
                "is_user_uploaded": false
            },
            "compendium_code": 18310,
            "name": "swimming",
            "description": null,
            "benefits": null
        }
    ]
}


Was this article helpful?
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence