Skip to main content

POST /v1/locations

Create a new haunted location record. Locations can be public (visible to the community) or private (visible only to the creator).
This endpoint validates input but does not persist data to the database yet. It currently returns a plain-text debug output.

Request Body

name
string
required
Name of the haunted location (max 500 bytes)
address
string
required
Full street address of the location
state
string
U.S. state where the location is situated
city
string
City where the location is situated
zip
string
ZIP code of the location
lore
string
required
Historical background and paranormal lore associated with the location (max 500 bytes)
latitude
number
required
Latitude coordinate (-90 to 90)
longitude
number
required
Longitude coordinate (-180 to 180)
visibility
boolean
required
Whether the location is public (true) or private (false)
popularity
integer
Popularity rating of the location (star rating system)
past_investigations_user
array
Array of investigation IDs conducted by the user at this location
past_investigations_community
array
Array of investigation IDs conducted by the community at this location

Validation Rules

  • name: Required, max 500 bytes
  • address: Required, must be a valid address format
  • lore: Required, max 500 bytes
  • latitude: Must be a valid finite number between -90 and 90
  • longitude: Must be a valid finite number between -180 and 180

Response

id
integer
Unique identifier for the created location
name
string
Name of the location
address
string
Full address
state
string
State
city
string
City
zip
string
ZIP code
lore
string
Historical and paranormal background
latitude
number
Latitude coordinate
longitude
number
Longitude coordinate
visibility
boolean
Public or private status
popularity
integer
Popularity rating
created_by_user_id
integer
ID of the user who created this location
owner_user_id
integer
ID of the location owner

Example Request

curl -X POST http://localhost:4000/v1/locations \
  -H "Content-Type: application/json" \
  -d '{
    "name": "The Waverly Hills Sanatorium",
    "address": "4400 Paralee Drive",
    "city": "Louisville",
    "state": "Kentucky",
    "zip": "40272",
    "lore": "Originally a tuberculosis hospital, Waverly Hills is known for the Room 502 haunting and shadow people sightings throughout the facility.",
    "latitude": 38.1346,
    "longitude": -85.9341,
    "visibility": true,
    "popularity": 5
  }'

Example Response

{
  "name": "The Waverly Hills Sanatorium",
  "address": "4400 Paralee Drive",
  "city": "Louisville",
  "state": "Kentucky",
  "zip": "40272",
  "lore": "Originally a tuberculosis hospital, Waverly Hills is known for the Room 502 haunting and shadow people sightings throughout the facility.",
  "latitude": 38.1346,
  "longitude": -85.9341,
  "visibility": true,
  "popularity": 5,
  "past_investigations_user": [],
  "past_investigations_community": []
}

GET /v1/locations/:id

Retrieve a specific location by its ID.
This endpoint currently returns mock/placeholder data for testing purposes. Database retrieval is not yet implemented.

Path Parameters

id
integer
required
The unique identifier of the location

Response

location
object
The location record

Example Request

curl http://localhost:4000/v1/locations/42

Example Response

{
  "location": {
    "id": 42,
    "name": "Dork Knight",
    "address": "123 Apple lane",
    "lore": "Ghost",
    "latitude": 1235,
    "longitude": -93949,
    "past_investigations_user": [],
    "past_investigations_community": [],
    "popularity": 32,
    "visibility": true
  }
}

Error Responses

400 Bad Request

Returned when the request body is malformed or ID parameter is invalid.
{
  "error": "invalid id parameter"
}

404 Not Found

Returned when the location does not exist.
{
  "error": "the requested resource could not be found"
}

422 Unprocessable Entity

Returned when validation fails on the provided data.
{
  "error": {
    "name": "must be provided",
    "latitude": "must be between -90 and 90",
    "longitude": "must be between -180 and 180"
  }
}

500 Internal Server Error

Returned when the server encounters an unexpected error.
{
  "error": "the server encountered a problem and could not process your request"
}

Build docs developers (and LLMs) love