← Back to Explorer

πŸ‡ΊπŸ‡Έ US States API

RESTful API for US State data β€” INF653 Final Project

Base URL https://inf653-final.catsoup.dev/states
GET Endpoints
GET
/states/
Returns all 50 states with their data
GET
/states/?contig=true
Returns only contiguous (lower 48) states
GET
/states/?contig=false
Returns non-contiguous states only (AK, HI)
GET
/states/:state
Returns all data for a single state
Param: :state β€” 2-letter state abbreviation (e.g. KS, CA)
GET
/states/:state/funfact
Returns a random fun fact for the state
GET
/states/:state/capital
Returns the state's capital city
GET
/states/:state/nickname
Returns the state's nickname
GET
/states/:state/population
Returns the state's population (comma-formatted)
GET
/states/:state/admission
Returns the state's admission date
GET
/states/rank/population
All states ranked by population
Query: ?order=asc|desc β€” sort order (default: desc)
GET
/states/rank/admission
All states ranked by admission order
Query: ?order=asc|desc β€” sort order (default: asc)
GET
/states/admitted/:year
States admitted in a specific year
Param: :year β€” 4-digit year (e.g. 1787)
GET
/states/admitted/before/:year
States admitted strictly before a given year
Param: :year β€” 4-digit year (e.g. 1800)
GET
/states/admitted/after/:year
States admitted strictly after a given year
Param: :year β€” 4-digit year (e.g. 1900)
GET
/states/search?name=
Search states by name (partial, case-insensitive)
Query: ?name=new β€” returns all states whose name contains the search term
POST Endpoints
POST
/states/:state/funfact
Add one or more fun facts to a state
Body (JSON): { "funfacts": ["fact1", "fact2"] }
PATCH Endpoints
PATCH
/states/:state/funfact
Update a fun fact by index
Body (JSON): { "index": 1, "funfact": "Updated fact" }
DELETE Endpoints
DELETE
/states/:state/funfact
Delete a fun fact by index
Body (JSON): { "index": 1 }
Note: State codes must be valid 2-letter US state abbreviations (case-insensitive). Invalid codes return { "message": "Invalid state abbreviation parameter" }.