API Reference - Location States Mapping
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108126
← Back to API Reference | Getting Started
Location States Mapping
The Location States Mapping table stores the list of states and regions that a directory site has enabled for location-based browsing and SEO page generation. Unlike the global list_states reference table, this table contains only the states that are actively used on a specific site. Each record maps a state short code to its full name, URL slug, and country, enabling the platform to generate state-level browse pages and location filters. This is primarily a reference table used for GET operations; while CRUD endpoints are available, records are typically managed through the admin panel.
location_states — DB table: location_statesThe Location State Object
| Field | Type | Description |
|---|---|---|
location_id | integer | Unique location state ID (primary key, read-only) |
state_sn | string | State/region short code (EG NY, CA); used for URL generation and cross-referencing location_cities; max 255 characters |
state_ln | string | Full state/region name (EG New York, California); max 255 characters |
state_filename | string | URL-friendly slug for the state browse page (EG new-york, california); max 255 characters |
country_sn | string | Country short code (EG US, CA); references list_countries.country_code; max 255 characters |
List Location States
Returns a paginated list of location state records.
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/location_states/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"status": "success",
"message": [
{
"location_id": "1",
"state_sn": "NY",
"state_ln": "New York",
"state_filename": "new-york",
"country_sn": "US"
},
{
"location_id": "2",
"state_sn": "CA",
"state_ln": "California",
"state_filename": "california",
"country_sn": "US"
}
],
"total": "65",
"current_page": 1,
"total_pages": 3,
"next_page": "MipfKjI="
}Retrieve a Location State Record
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/location_states/get/1" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"status": "success",
"message": [
{
"location_id": "1",
"state_sn": "NY",
"state_ln": "New York",
"state_filename": "new-york",
"country_sn": "US"
}
],
"total": "1",
"current_page": 1,
"total_pages": 1
}Create a Location State Record
Example Request
curl -X POST "https://www.yourdomain.com/api/v2/location_states/create" \ -H "X-Api-Key: your-api-key-here" \ -d "state_sn=TX" \ -d "state_ln=Texas" \ -d "state_filename=texas" \ -d "country_sn=US"
Example Response
{
"status": "success",
"message": {
"location_id": "66",
"state_sn": "TX",
"state_ln": "Texas",
"state_filename": "texas",
"country_sn": "US"
}
}Update a Location State Record
Example Request
curl -X PUT "https://www.yourdomain.com/api/v2/location_states/update" \ -H "X-Api-Key: your-api-key-here" \ -d "location_id=66" \ -d "state_filename=texas-tx"
Example Response
{
"status": "success",
"message": {
"location_id": "66",
"state_sn": "TX",
"state_ln": "Texas",
"state_filename": "texas-tx",
"country_sn": "US"
}
}Delete a Location State Record
Example Request
curl -X DELETE "https://www.yourdomain.com/api/v2/location_states/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "location_id=66"
Example Response
{
"status": "success",
"message": "location_states record was deleted"
}