Food List allows to manage the content of one's pantry supporting different storage locations and product matching.
Use-case request examples
Get foodlist including deleted (i.e. consumed) items
Copy curl -X GET "https://api.whisk.com/foodlist/v2?filters.presence=PRESENCE_FILTER_EXISTING&filters.presence=PRESENCE_FILTER_CONSUMED&sorting.by=SORT_BY_CREATED_AT&sorting.direction=SORT_DIRECTION_DESC" \
-H "accept: application/json" \
-H "Authorization: Bearer %USER_TOKEN%" \
-H "Content-Type: application/json"
Add wine into the Wine Fridge location
Complete set of enum values forlocation
andzone
can be found in docs .
location_id
allows defining in what location the item is going. For example, a user may have two wine fridges, location_id
will let you distinguish them.
Whisk will validate the one item per slot rule, i.e. the API will return an error if try to put several items in the same slot.
Copy curl -X POST "https://api.whisk.com/foodlist/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER TOKEN%" -H "Content-Type: application/json" -d '{
"add":{
"items":[
{
"name":"test on qa-2",
"quantity":10,
"unit":"l",
"expiry_date":{
"year":2023,
"month":11,
"day":2
},
"location":"FOOD_ITEM_LOCATION_WINE_FRIDGE",
"location_zone_place":{
"wine_fridge_placing":{
"zone":"WINE_FRIDGE_LOCATION_ZONE_BOTTOM",
"place":785
}
},
"image":{
"url":"https://whisk-res.cloudinary.com/image/upload/v1629877880/v3/user-recipes/nlddh9ajshcbgwxcawcg.jpg"
},
"display_name":"first test",
"food_item_type":{
"wine_item":{
"wine_type":"WINE_TYPE_RED",
"grape_type":"grape",
"vintage":1,
"winery":"winery",
"country_of_origin":"UK",
"region_of_origin":"UK",
"body":1,
"acidity":2,
"tannin":1,
"dryness":1,
"manufacturer":"s",
"alcohol":12,
"score":1,
"review_wine_graph":"string"
}
},
"price":{
"currency_code":"USD",
"cents":"5"
},
"memo":"memo"
}
]
}
}'
Get wine items only from foodlist
Copy curl -X GET "https://api.whisk.com/foodlist/v2?filters.foodItemType=FOOD_TYPE_FILTER_WINE_ITEM" \
-H "accept: application/json" \
-H "Authorization: Bearer %USER_TOKEN%" \
-H "Content-Type: application/json"
Add meat specifying storage mode
Complete set of enum values for meat_mode
can be found in docs .
Copy curl -X POST "https://api.whisk.com/foodlist/v2/item" -H "accept: application/json" -H "Authorization: Bearer %USER TOKEN%" -H "Content-Type: application/json" -d '{
"add":{
"items":[
{
"name":"Huge Steak",
"quantity":750,
"unit":"g",
"expiry_date":{
"year":2022,
"month":9,
"day":3
},
"location":"FOOD_ITEM_LOCATION_MULTIPANTRY",
"image":{
"url":"https://whisk-res.cloudinary.com/image/upload/v1629877880/v3/user-recipes/nlddh9ajshcbgwxcawcg.jpg"
},
"display_name":"Steak",
"location_id":"user-device-id",
"food_item_type":{
"meat_item":{
"meat_mode":"MEAT_MODE_AGE",
"animal_trace_id":"123456ABCDEF",
"country_of_origin":"KR"
}
},
"price":{
"currency_code":"USD",
"cents":300
},
"memo":"My favourite farm steak to age",
"manufactured_at":{
"from":"1638361352",
"to":"1638361353"
}
}
]
}
}'
Update or remove certain fields
Copy curl -v -X POST "https://api.whisk.com/foodlist/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json" -d '
{
"update":{
"items":[
{
"id":"a05731b8-0c2c-4f0b-b64f-3e2b25ed04ac",
"fields":{
"food_item_type":{
"wine_item":{
"grape_type":"update",
"vintage":1,
"winery":"update",
"country_of_origin":"update",
"region_of_origin":"update",
"body":1,
"acidity":1,
"tannin":1,
"dryness":1,
"manufacturer":"update",
"alcohol":1,
"score":1,
"review_wine_graph":"update",
"wine_id":"update",
"wine_type":"WINE_TYPE_RED"
}
}
},
"mask":{
"paths":[
"name",
"expiry_date",
"location",
"added_at",
"food_item_type",
"manufactured_at"
]
}
}
]
}
}
'
Mark an item as consumed (soft-delete)
Copy curl -v -X POST 'https://api.whisk.com/foodlist/v2/action' -H 'Authorization: Bearer %USER_TOKEN%'
-H "Content-Type: application/json"
-d '{"consume": {
"id": [
"uuid-uuid-uuid-uuid-uuid"
]
}
}'
Get recently added items
Copy curl -X GET "https://api.whisk.com/foodlist/v2/recent?items_count=5&include_hidden_items=false"
-H 'Authorization: Bearer %USER_TOKEN%'
Hide items from recently added history
Copy curl -X POST "https://api.whisk.com/foodlist/v2/recent/hide"
-H "Content-Type: application/json"
-H 'Authorization: Bearer %USER_TOKEN%'
-d '{ "ids": [ "uuid-uuid-uuid-uuid" ]}'
Add an item directly as consumed into the Food List specifying it was AI autogenerated
If UI requires some kind of grouping items together (e.g. with the same deposit date, it should be implemented on the client side)
If an item with an already existing external_id
is being added, we will ignore it for now. Since the API is designed as a batched one, the proper error management is tricky to add to avoid failing the whole batch of operations. While the requirements are not 100% clear it's easier to skip.
All timestamp fields (e.g. added_at
) are accepted and returned in Epoch seconds (not millis, sanity check is to have 10 numbers, not 13) e.g. 1691024523
Copy curl -X POST "https://api.whisk.com/foodlist/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json"
-d '{
"add":{
"items":[
{
"name":"orange juice",
"quantity":1,
"unit":"l",
"expiry_date":{
"year":2023,
"month":12,
"day":21
},
"location":"FOOD_ITEM_FRIDGE",
"image":{
"url":"https://..."
},
"display_name":"orange juice",
"location_id":"string",
"external_id":"string",
"added_at": "1691024523",
"consumed_at": "1691024523",
"ai_generated": true
}
]
}
}'
Mark items as consumed by external_id
Copy curl -X POST "https://api.whisk.com/foodlist/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json"
-d '{
"consume":{
"external_id": [
"string"
],
"consumed_at": "1691024523"
}
}'
Get all items added within a certain period
Copy curl -X GET "https://api.whisk.com/foodlist/v2?filters.presence=PRESENCE_FILTER_EXISTING&filters.presence=PRESENCE_FILTER_CONSUMED&filters.added_at.from=1691024523&filters.added_at.to=1691110923&sorting.by=SORT_BY_UPDATED_AT&sorting.direction=SORT_DIRECTION_DESC" -H "Authorization: Bearer %USER_TOKEN%" -H "accept: application/json"
Get items consumed within a certain period
Copy curl -X GET "https://api.whisk.com/foodlist/v2?filters.presence=PRESENCE_FILTER_CONSUMED&filters.consumed_at.from=1691024523&filters.consumed_at.to=1691110923&sorting.by=SORT_BY_UPDATED_AT&sorting.direction=SORT_DIRECTION_DESC" -H "Authorization: Bearer %USER_TOKEN%" -H "accept: application/json"
Unmark the item as consumed (i.e. return to existing)
Copy curl -v -X POST "https://api.whisk.com/foodlist/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json" -d '
{
"update":{
"items":[
{
"id":"a05731b8-0c2c-4f0b-b64f-3e2b25ed04ac",
"fields":{
"consumed_at":null
},
"mask":{
"paths":[
"consumed_at"
]
}
}
]
}
}
'
Add item as temporary out
Copy curl -X POST "https://api.whisk.com/foodlist/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json"
-d '{
"add":{
"items":[
{
"name":"orange juice",
"quantity":1,
"unit":"l",
"expiry_date":{
"year":2023,
"month":12,
"day":21
},
"location":"FOOD_ITEM_FRIDGE",
"image":{
"url":"https://..."
},
"display_name":"orange juice",
"location_id":"string",
"external_id":"string",
"added_at": "1691024523",
"temporary_out_at": "1691024523",
"ai_generated": true
}
]
}
}'
Mark item as temporary out
Copy curl -v -X POST "https://api.whisk.com/foodlist/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json" -d '
{
"update":{
"items":[
{
"id":"a05731b8-0c2c-4f0b-b64f-3e2b25ed04ac",
"fields":{
"temporary_out_at":"1691024523"
},
"mask":{
"paths":[
"temporary_out_at"
]
}
}
]
}
}
'
Mark item as presented in food list (back from temporary out)
Copy curl -v -X POST "https://api.whisk.com/foodlist/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json" -d '
{
"update":{
"items":[
{
"id":"a05731b8-0c2c-4f0b-b64f-3e2b25ed04ac",
"fields":{
"temporary_out_at":null
},
"mask":{
"paths":[
"temporary_out_at"
]
}
}
]
}
}
'
Request temporary out items
Copy curl -X GET "https://api.whisk.com/foodlist/v2?filters.presence=PRESENCE_FILTER_TEMPORARY_OUT&sorting.by=SORT_BY_UPDATED_AT&sorting.direction=SORT_DIRECTION_DESC" -H "Authorization: Bearer %USER_TOKEN%" -H "accept: application/json"
Last updated 9 months ago