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 of the haunted location (max 500 bytes)
Full street address of the location
U.S. state where the location is situated
City where the location is situated
Historical background and paranormal lore associated with the location (max 500 bytes)
Latitude coordinate (-90 to 90)
Longitude coordinate (-180 to 180)
Whether the location is public (true) or private (false)
Popularity rating of the location (star rating system)
Array of investigation IDs conducted by the user at this location
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
Unique identifier for the created location
Historical and paranormal background
ID of the user who created this location
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
The unique identifier of the location
Response
The location record Historical and paranormal background
User investigations at this location
Community investigations at this location
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"
}