Categories can be retrieved by using the following URL and specifying a starting record number and ending record number. If left blank, this will default to the first 50 records. Categories are returned in order of name.
| Method | URL |
| GET | https://api.fairwarningsoftware.com/v1.1.1/categories/[start]/[limit] |
| Status | Response |
| 200 |
{"categories":[ |
| 401 | {"error":"The API keys provided are invalid."} |
| 403 | {"error":"API keys are missing."} |
| 500 | {"error": <custom error>} |
| Field | Type | Description |
| category_id | int | The unique identifier for the category |
| company_id | int | The ID for your company |
| category_active | bool | Whether the category is active or not |
| category_parent_id | int | The ID of the current category's parent category |
| category_name | string | The name of the category |
| record_count | int | The total number of records matching the search results |
By default, only primary categories will be returned. (Categories with no parent.) To get sub categories, you must specify the parent category ID by passing it in the JSON raw post data.
{ "category_parent_id": { "operator" : "equals", "value": 59 } }
By passing this data string as raw post data, you will receive all categories that belong to the category with the ID of 59.
However, you may request a list of categories that include sub categories as well by passing "include_subs" with either a "1" or a "2" to get up to 1 or 2 levels of sub categories. For instance:
{ "include_subs" : 2 }
This will return all primary categories with sub categories up to 2 levels deep. This may also be used on the above search to include sub categories of the category with the ID of 59.