Skip to content

Temple APIs

Base path: /api/temples

Temple responses include mapUrl when latitude and longitude are available.

Create Temple

http
POST /api/temples

Body

json
{
  "nameEn": "Angkor Wat",
  "nameKm": "អង្គរវត្ត",
  "description": "Temple description",
  "imageUrl": "https://example.com/angkor.jpg",
  "provinceId": "17",
  "districtId": "1702",
  "communeId": "170201",
  "villageId": "17020101",
  "latitude": 13.4125,
  "longitude": 103.867
}
FieldTypeRequiredNotes
nameEnstringYesEnglish name.
nameKmstringNoKhmer name.
descriptionstringNoTemple description.
imageUrlstringNoPublic image URL.
provinceIdstringNoProvince ID.
districtIdstringNoDistrict ID.
communeIdstringNoCommune ID.
villageIdstringNoVillage ID.
latitudenumber or stringNoMust be numeric when provided.
longitudenumber or stringNoMust be numeric when provided.

Blank optional string fields are stored as null.

Response

Returns 201.

json
{
  "success": true,
  "message": "Temple created successfully",
  "data": {
    "id": 1,
    "nameEn": "Angkor Wat",
    "nameKm": "អង្គរវត្ត",
    "description": "Temple description",
    "imageUrl": "https://example.com/angkor.jpg",
    "provinceId": "17",
    "districtId": "1702",
    "communeId": "170201",
    "villageId": "17020101",
    "latitude": 13.4125,
    "longitude": 103.867,
    "createdAt": "2026-05-30T00:00:00.000Z",
    "updatedAt": "2026-05-30T00:00:00.000Z",
    "mapUrl": "https://www.google.com/maps/search/?api=1&query=13.4125,103.867"
  }
}

Validation failures return 400, including missing nameEn or invalid latitude and longitude values.

List Temples

http
GET /api/temples?q=angkor&provinceId=17&limit=20&offset=0

Query Parameters

NameTypeRequiredNotes
qstringNoSearch text.
provinceIdstringNoFilter by province.
districtIdstringNoFilter by district.
communeIdstringNoFilter by commune.
villageIdstringNoFilter by village.
limitstringNoPage size.
offsetstringNoRow offset.

limit defaults to 50, is capped at 100, and has a minimum of 1. offset defaults to 0.

Response

json
{
  "success": true,
  "message": "Success",
  "data": [
    {
      "id": 1,
      "nameEn": "Angkor Wat",
      "nameKm": "អង្គរវត្ត",
      "description": "Temple description",
      "imageUrl": "https://example.com/angkor.jpg",
      "provinceId": "17",
      "districtId": "1702",
      "communeId": "170201",
      "villageId": "17020101",
      "latitude": 13.4125,
      "longitude": 103.867,
      "createdAt": "2026-05-30T00:00:00.000Z",
      "updatedAt": "2026-05-30T00:00:00.000Z",
      "mapUrl": "https://www.google.com/maps/search/?api=1&query=13.4125,103.867"
    }
  ]
}

Get Temple By ID

http
GET /api/temples/:id

Parameters

NameInTypeRequired
idpathnumberYes

Invalid IDs return 400. Missing temples return 404.

Response

Returns one temple object in the same shape as list results.