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.

Model name in URL: location_cities — DB table: location_cities

The Location City Object

FieldTypeDescription
locaiton_idintegerUnique city location ID (primary key, read-only). Note: field name contains a typo in the database schema (locaiton_id not location_id).
city_lnstringFull city name (EG New York, Los Angeles); max 255 characters
city_filenamestringURL-friendly slug for the city (EG new-york, los-angeles); max 255 characters
state_snstringState/region short code (EG NY, CA); references location_states.state_sn; max 255 characters
country_snstringCountry short code (EG US, CA); references list_countries.country_code; max 255 characters

List Location Cities

GET /api/v2/location_cities/get

Returns a paginated list of location city records.

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/location_cities/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "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

GET /api/v2/location_cities/get/{locaiton_id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/location_cities/get/1" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "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

POST /api/v2/location_cities/create

Example Request

Copy
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

Copy
{
  "status": "success",
  "message": {
    "locaiton_id": "230",
    "city_ln": "Austin",
    "city_filename": "austin",
    "state_sn": "TX",
    "country_sn": "US"
  }
}

Update a Location City Record

PUT /api/v2/location_cities/update

Example Request

Copy
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

Copy
{
  "status": "success",
  "message": {
    "locaiton_id": "230",
    "city_ln": "Austin",
    "city_filename": "austin-tx",
    "state_sn": "TX",
    "country_sn": "US"
  }
}

Delete a Location City Record

DELETE /api/v2/location_cities/delete

Example Request

Copy
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

Copy
{
  "status": "success",
  "message": "location_cities record was deleted"
}