fatsecret Platform API Documentation
Food Categories: Get All
Description
This is a utility method, returning the full list of all food categories and their associated unique identifiers.
Why are we introducing this version?
Parameters
URL / Method
| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| URL (new) Method |
N/A | Required | "https://platform.fatsecret.com/rest/food-categories/v2" HTTP "GET" |
| OR | |||
| method | String | Required | "food_categories.get.v2" (included with other parameters) |
Additional Parameters
| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| region | String | Optional | Results will be filtered by region. E.G.: "FR" returns results from France. If not specified this will default to "US" (United States). Click here for full documentation on localization. |
| language | String | Optional | (Ignored unless region is also specified) Results will be in the specified language. E.G.: "fr" returns results in French |
| format | String | Optional | The desired response format. Valid response formats are "xml" or "json" (default value is "xml"). |
Response
food_category_id. Each food_category element contains information as follows:
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| food_category_id | Long | Unique identifier of the food category entry |
| food_category_name | String | Name of the food category |
| food_category_description | String | Description of the food category |
Example Response
Example 1:
<?xml version="1.0" encoding="utf-8" ?>
<food_categories 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">
<food_category>
<food_category_id>1</food_category_id>
<food_category_name>Beans & Legumes</food_category_name>
<food_category_description>All types of beans and legumes like baked beans, green beans, refried beans and lentils.</food_category_description>
</food_category>
</food_categories>
Example 1:
{
"food_categories": {
"food_category": [
{
"food_category_description": "All types of beans and legumes like baked beans, green beans, refried beans and lentils.",
"food_category_id": "1",
"food_category_name": "Beans & Legumes"
}
]
}
}
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>' |