Endpoint #
GET /wp-json/rtcl/v1/locations
Authentication #
๐ Required
REST API Permission handled by API Key named x-api-key
Request Parameters #
| Parameter | Type | Required | Description |
|---|---|---|---|
parent_id | integer | No | ID of the parent location to fetch sub-locations from. Must be an integer. |
Response #
Returns an array of locations with metadata including name, slug, description, parent, and post count.
Response Example #
[
{
"term_id": 16,
"name": "California",
"slug": "california",
"description": "lorem ipsum lorem ipsum lorem ipsum lorem ipsum",
"parent": 0,
"count": 8
},
{
"term_id": 80,
"name": "Bakersfield",
"slug": "bakersfield",
"description": "",
"parent": 16,
"count": 5
}
]
Response Fields #
| Field | Type | Description |
|---|---|---|
term_id | integer | Unique ID of the location |
name | string | Name of the location |
slug | string | Slug of the location |
description | string | Description text of the location |
parent | integer | Parent location ID |
count | integer | Number of posts/listings in this location |
Notes #
- If no
parent_idis provided, top-level locations are returned. - Locations are hierarchical; each location may have sub-locations.
- Results are cached using WordPress transients for 1 week.
- Useful for building location filters or maps in frontend interfaces.