API Reference - Location Cities
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108125
← Back to API Reference | Getting Started
Location Cities
The Location Cities table stores the list of cities used for location-based search and SEO page generation on a directory site. Each record maps a city name to its state and country codes, enabling the platform to generate city-specific browse pages and filter search results by location. This is primarily a reference table used for GET operations; while CRUD endpoints are available, city records are typically managed through the admin panel.
location_cities — DB table: location_citiesThe Location City Object
| Field | Type | Description |
|---|---|---|
locaiton_id | integer | Unique city location ID (primary key, read-only). Note: field name contains a typo in the database schema (locaiton_id not location_id). |
city_ln | string | Full city name (EG New York, Los Angeles); max 255 characters |
city_filename | string | URL-friendly slug for the city (EG new-york, los-angeles); max 255 characters |
state_sn | string | State/region short code (EG NY, CA); references location_states.state_sn; max 255 characters |
country_sn | string | Country short code (EG US, CA); references list_countries.country_code; max 255 characters |
List Location Cities
Returns a paginated list of location city records.
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/location_cities/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"status": "success",
"message": [
{
"locaiton_id": "1",
"city_ln": "New York",
"city_filename": "new-york",
"state_sn": "NY",
"country_sn": "US"
},
{
"locaiton_id": "2",
"city_ln": "Seal Beach",
"city_filename": "seal-beach",
"state_sn": "CA",
"country_sn": "US"
}
],
"total": "229",
"current_page": 1,
"total_pages": 10,
"next_page": "MipfKjI="
}Retrieve a Location City Record
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/location_cities/get/1" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"status": "success",
"message": [
{
"locaiton_id": "1",
"city_ln": "New York",
"city_filename": "new-york",
"state_sn": "NY",
"country_sn": "US"
}
],
"total": "1",
"current_page": 1,
"total_pages": 1
}Create a Location City Record
Example Request
curl -X POST "https://www.yourdomain.com/api/v2/location_cities/create" \ -H "X-Api-Key: your-api-key-here" \ -d "city_ln=Austin" \ -d "city_filename=austin" \ -d "state_sn=TX" \ -d "country_sn=US"
Example Response
{
"status": "success",
"message": {
"locaiton_id": "230",
"city_ln": "Austin",
"city_filename": "austin",
"state_sn": "TX",
"country_sn": "US"
}
}Update a Location City Record
Example Request
curl -X PUT "https://www.yourdomain.com/api/v2/location_cities/update" \ -H "X-Api-Key: your-api-key-here" \ -d "locaiton_id=230" \ -d "city_filename=austin-tx"
Example Response
{
"status": "success",
"message": {
"locaiton_id": "230",
"city_ln": "Austin",
"city_filename": "austin-tx",
"state_sn": "TX",
"country_sn": "US"
}
}Delete a Location City Record
Example Request
curl -X DELETE "https://www.yourdomain.com/api/v2/location_cities/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "locaiton_id=230"
Example Response
{
"status": "success",
"message": "location_cities record was deleted"
}