Logging using Text Search
To log a meal by text search requires the following steps.
Search Items By Text
Searching by text requires a query. The query parameter executes a full text search. For exact matching or brand search see the query parameters for search.
curl -X GET https://api-beta.bite.ai/items/search/?query=cheese
The response includes a list of items ranked.
{"count": 14846,"next": "https://api-beta.bite.ai/items/search/?limit=100&offset=100&query=cheese","previous": null,"results": [{"id": "23c66800-5b53-443c-a464-2509d3bee813","name": "Cheese","brand": null,"details": null,"categorizations": {},"is_generic": true},{"id": "62a21113-689b-49ca-a349-37315292df87","name": "Macaroni And Cheese","brand": null,"details": null,"categorizations": {},"is_generic": true}]}
These results should be shown to the user. Nutrition facts and more specific subtypes about an item can be retrieved by looking up item details.
Adding an Item to a Meal
Using the meal_id
from the
Create a Meal operation and
item_id
an entry can be added using the meal_entries_create
operation.
curl -X POST https://api-beta.bite.ai/meals/422d6199-c1b6-4037-866f-e28c1ea0b0ca/entries/ \-d '{"item": "23c66800-5b53-443c-a464-2509d3bee813","serving_amount": 1,"nutrition_fact": "3599556d-fb5e-445b-b0fb-28842bc01e0d"}'
The item will be added to the meal.
{"id": "753b4dd1-e2f3-4521-a033-378a668c3482","item": {},"serving_amount": 1,"nutrition_fact": "3599556d-fb5e-445b-b0fb-28842bc01e0d","image": null,"time_created": "2018-03-27T05:12:51.019693Z","time_modified": "2018-03-27T05:12:51.019963Z"}