MyFitnessPal icon

MyFitnessPal

Interact with MyFitnessPal API

Overview

This node integrates with the MyFitnessPal API to perform various health and nutrition-related operations. Specifically, the "Search Foods" operation allows users to search for food items in the MyFitnessPal database by providing a search query. This is useful for applications that need to find nutritional information about foods, such as meal planning apps, diet tracking tools, or fitness platforms.

For example, a user can input "chicken breast" as the search query, and the node will return a list of matching food items from the database, limited by the maximum number of results specified.

Properties

Name Meaning
Search Query The term used to search for food items in the MyFitnessPal database (e.g., "chicken breast").
Max Results Maximum number of food items to return from the search. Accepts numbers up to 50.

Output

The output is an array of JSON objects, each representing a food item returned by the search query. Each object contains detailed information about a food item as provided by the MyFitnessPal API. The exact structure depends on the API response but typically includes fields like food name, brand, serving size, calories, and other nutritional data.

No binary data is output by this operation.

Dependencies

  • Requires an API key credential for authenticating with the MyFitnessPal API.
  • The node uses the MyFitnessPal API endpoint https://api.myfitnesspal.com/v2/foods/search.
  • Proper configuration of the API authentication within n8n is necessary for successful requests.

Troubleshooting

  • Common Issues:

    • Invalid or missing API credentials will cause authentication failures.
    • Exceeding the maximum allowed results (more than 50) may result in errors or truncated responses.
    • Network connectivity issues can prevent the node from reaching the MyFitnessPal API.
  • Error Messages:

    • Authentication errors typically indicate invalid or expired API keys; reconfigure the API credentials.
    • Validation errors may occur if required parameters like the search query are empty; ensure all required inputs are provided.
    • Rate limiting errors from the API suggest too many requests in a short period; implement retries with delays.

Links and References

Discussion