Skip to main content

Overview

The Sites API allows you to manage camera installation locations (sitios) across different localities. You can create, read, update, and delete site records, as well as export site data to Excel format.

List Sites

Retrieve a paginated list of camera sites with search and filtering capabilities.
GET /sitios

Query Parameters

texto
string
Search text to filter sites by name, locality, or associated dependency (destino). The search is case-insensitive and uses partial matching.

Response

Returns a paginated list of sites (100 per page) ordered by ID.
id
integer
Unique identifier for the site
nombre
string
required
Name of the camera site location
latitud
decimal
Latitude coordinate for the site location
longitud
decimal
Longitude coordinate for the site location
localidad
string
required
Locality where the site is located. Valid options:
  • Paraná
  • Colonia Avellaneda
  • Oro Verde
  • San Benito
cartel
boolean
Indicates whether the site has signage (SI/NO converted to true/false)
activo
boolean
required
Indicates whether the site is active
destino_id
integer
required
Foreign key reference to the associated dependency (Destino)
observaciones
text
Additional notes or observations about the site
destino
object
Associated dependency object with its details

Example Request

curl -X GET "https://your-domain.com/sitios?texto=Paraná" \
  -H "Cookie: your-session-cookie"

Create Site

Create a new camera site location.
POST /sitios

Required Permissions

  • crear-sitio

Request Body

nombre
string
required
Name of the camera site location
localidad
string
required
Locality for the site. Must be one of:
  • Paraná
  • Colonia Avellaneda
  • Oro Verde
  • San Benito
destino_id
integer
required
ID of the associated dependency (must exist in destinos table)
activo
boolean
required
Whether the site is active (true/false or 1/0)
latitud
decimal
Latitude coordinate for the site location
longitud
decimal
Longitude coordinate for the site location
cartel
string
Whether the site has signage. Valid values: “SI” or “NO” (converted to boolean)
observaciones
text
Additional notes or observations about the site

Example Request

curl -X POST "https://your-domain.com/sitios" \
  -H "Content-Type: application/json" \
  -H "Cookie: your-session-cookie" \
  -d '{
    "nombre": "Sitio Plaza 1° de Mayo",
    "localidad": "Paraná",
    "latitud": "-31.7413",
    "longitud": "-60.5115",
    "cartel": "SI",
    "activo": true,
    "destino_id": 1,
    "observaciones": "Cámara ubicada en poste frente a la plaza"
  }'

Response

On success, redirects to /sitios (index page).

Error Responses

result
string
“ERROR” if the operation fails
message
string
Detailed error message describing what went wrong

Edit Site

Retrieve site details for editing.
GET /sitios/{id}/edit

Required Permissions

  • editar-sitio

Path Parameters

id
integer
required
The ID of the site to edit

Update Site

Update an existing camera site location.
PUT /sitios/{id}

Required Permissions

  • editar-sitio

Path Parameters

id
integer
required
The ID of the site to update

Request Body

Same parameters as Create Site (all fields can be updated).
nombre
string
required
Name of the camera site location
localidad
string
required
Locality for the site
destino_id
integer
required
ID of the associated dependency
activo
boolean
required
Whether the site is active
latitud
decimal
Latitude coordinate
longitud
decimal
Longitude coordinate
cartel
string
Whether the site has signage (“SI” or “NO”)
observaciones
text
Additional notes

Example Request

curl -X PUT "https://your-domain.com/sitios/1" \
  -H "Content-Type: application/json" \
  -H "Cookie: your-session-cookie" \
  -d '{
    "nombre": "Sitio Plaza 1° de Mayo - Actualizado",
    "localidad": "Paraná",
    "latitud": "-31.7413",
    "longitud": "-60.5115",
    "cartel": "SI",
    "activo": true,
    "destino_id": 1,
    "observaciones": "Cámara reubicada al poste sur"
  }'

Response

On success, redirects to /sitios (index page).

Delete Site

Delete a camera site location.
DELETE /sitios/{id}

Required Permissions

  • borrar-sitio

Path Parameters

id
integer
required
The ID of the site to delete

Response

On success, redirects to /sitios (index page).
Deleting a site will also affect related records (cameras, audits) due to foreign key relationships. Ensure you understand the cascade behavior before deleting.

Export Sites to Excel

Export all sites to an Excel file.
GET /sitios/export

Response

Downloads an Excel file named ListadoSitios_{timestamp}.xlsx containing all site records.

Example Request

curl -X GET "https://your-domain.com/sitios/export" \
  -H "Cookie: your-session-cookie" \
  -o sites_export.xlsx

Validation Rules

When creating or updating sites, the following validation rules apply:
  • nombre: Required string field
  • localidad: Required, must be one of the valid localities (not “Seleccionar localidad”)
  • destino_id: Required, must reference an existing dependency (not “Seleccionar la dependencia”)
  • activo: Required boolean value
  • latitud: Optional decimal value
  • longitud: Optional decimal value
  • cartel: Optional, “SI” or “NO”
  • observaciones: Optional text field

Error Codes

422
Validation Error
Validation failed. Check the error messages for specific field errors.
403
Forbidden
You don’t have the required permission to perform this action.
500
Server Error
Database transaction failed. Returns JSON with error details:
{
  "result": "ERROR",
  "message": "Detailed error message"
}

Relationships

Sites have the following relationships:
  • destino (belongs to): Associated dependency/department
  • camaras (has many): Cameras installed at this site
  • auditorias (has many): Audit records for this site

Statistics

The index page provides statistics broken down by locality:
  • Total sites in Paraná
  • Total sites in Colonia Avellaneda
  • Total sites in San Benito
  • Total sites in Oro Verde

Build docs developers (and LLMs) love