fatsecret Platform API Documentation
Food Classification Levels: Get All
Description
This is a utility method returning the full food classification hierarchy as three lists — one per level.
Identifiers returned in the latest food.get and foods.search endpoints are
resolved against these lists (where include_food_classification_data is enabled as part of that request).
Each food belongs to exactly one entry at each level, matching the identifier in its classification element.
Food Classification Levels are expected to rarely change and can be cached.
Access
This method is available for Premier and Premier Free accounts, and can be enabled by getting in touch to enable Premier Exclusive features on your account.
Parameters
URL / Method
Response
Each level element contains information as follows:
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| id | Long | Unique identifier for this classification level entry |
| name | String | Name of this classification level entry (English only). E.G.: Dairy Products and Eggs |
| parent_id | Long | Unique identifier of this entry's parent in the level above. Not returned for level 1 entries, which have no parent |
Example Response
Example 1:
<?xml version="1.0" encoding="utf-8"?>
<food_classification_levels xmlns="http://platform.fatsecret.com/api/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://platform.fatsecret.com/api/1.0/ http://platform.fatsecret.com/api/1.0/fatsecret.xsd">
<level_1>
<level>
<id>10004</id>
<name>Grains, Pasta and Noodles</name>
</level>
<level>
<id>10011</id>
<name>Meat and Poultry</name>
</level>
</level_1>
<level_2>
<level>
<id>20026</id>
<parent_id>10004</parent_id>
<name>Cereal Products</name>
</level>
<level>
<id>20059</id>
<parent_id>10011</parent_id>
<name>Poultry (Prepared)</name>
</level>
</level_2>
<level_3>
<level>
<id>30076</id>
<parent_id>20026</parent_id>
<name>Breakfast Cereals - Ready to consume</name>
</level>
<level>
<id>30174</id>
<parent_id>20059</parent_id>
<name>Chicken (Prepared)</name>
</level>
</level_3>
</food_classification_levels>
Example 1:
{
"food_classification_levels": {
"level_1": {
"level": [
{
"id": "10004",
"name": "Grains, Pasta and Noodles"
},
{
"id": "10011",
"name": "Meat and Poultry"
}
]
},
"level_2": {
"level": [
{
"id": "20026",
"name": "Cereal Products",
"parent_id": "10004"
},
{
"id": "20059",
"name": "Poultry (Prepared)",
"parent_id": "10011"
}
]
},
"level_3": {
"level": [
{
"id": "30076",
"name": "Breakfast Cereals - Ready to consume",
"parent_id": "20026"
},
{
"id": "30174",
"name": "Chicken (Prepared)",
"parent_id": "20059"
}
]
}
}
}
Error Codes
| CODE | TYPE | DESCRIPTION |
|---|---|---|
| 2 | OAuth 1.0 | Missing required oauth parameter: '<details>' |
| 3 | OAuth 1.0 | Unsupported oauth parameter: '<details>' |
| 4 | OAuth 1.0 | Invalid signature method: '<details>' |
| 5 | OAuth 1.0 | Invalid consumer key: '<details>' |
| 6 | OAuth 1.0 | Invalid/expired timestamp: '<details>' |
| 7 | OAuth 1.0 | Invalid/used nonce: '<details>' |
| 8 | OAuth 1.0 | Invalid signature: '<details>' |
| 9 | OAuth 1.0 | Invalid access token: '<details>' |
| 13 | OAuth 2.0 | Invalid token: '<details>' |
| 14 | OAuth 2.0 | Missing scope: '<details>' |
| 20 | General | System temporarily unavailable: '<details>' |