Overview
This node integrates with the MyFitnessPal API to add a food item entry to a user's daily food diary. It allows users to specify which food item they want to log, categorize it by meal type (e.g., breakfast, lunch), and define the serving size. This is useful for tracking nutritional intake throughout the day, managing diet plans, or monitoring calorie consumption.
Practical examples include:
- Logging a chicken breast as a lunch item with 2 servings.
- Adding a snack entry of a protein bar with a single serving.
- Tracking dinner meals by adding multiple food items separately.
Properties
| Name | Meaning |
|---|---|
| Food Item ID | The unique identifier of the food item to add to the diary. |
| Meal Type | The category of the meal this food belongs to. Options: Breakfast, Lunch, Dinner, Snacks. |
| Serving Size | Number of servings of the specified food item to log. |
Output
The output is an array containing one object per input item. Each object has a json field that holds the response from the MyFitnessPal API after adding the food item to the diary. This response typically includes details about the newly added diary entry such as confirmation, timestamps, and nutritional information.
No binary data is output by this node.
Dependencies
- Requires an active connection to the MyFitnessPal API.
- Needs an API authentication token configured in n8n credentials to authorize requests.
- The node makes HTTP POST requests to the endpoint
https://api.myfitnesspal.com/v2/diary/add.
Troubleshooting
- Common issues:
- Invalid or missing Food Item ID will cause the API request to fail.
- Incorrect or expired API authentication token will result in authorization errors.
- Providing an unsupported meal type value may cause the API to reject the request.
- Error messages:
- Errors returned from the API are captured and can be output if "Continue On Fail" is enabled.
- Typical error messages include "Unauthorized", "Food item not found", or "Invalid parameters".
- Resolutions:
- Verify the Food Item ID exists and is correct.
- Ensure the API key or authentication token is valid and has necessary permissions.
- Use only the supported meal types listed in the properties.
Links and References
- MyFitnessPal API Documentation (general reference; actual API docs may require access)
- n8n documentation on HTTP Request Node for understanding how API calls are made within nodes.