Skip to main content
This endpoint executes SELECT * FROM {table} against the PostgreSQL database and returns every row found. It is the primary way to populate dropdown lists, data grids, and reference tables on the frontend — for example, fetching all payment methods, municipalities, or customers in a single call.

Endpoint


Path Parameters

string
required
Name of the PostgreSQL table to query. The value is interpolated directly into the SQL statement as SELECT * FROM {table}. Common values used in the reference implementation:

Responses

200 — OK

Returned when at least one row is found (rowCount > 0).
number
Always 200 on success.
string
Human-readable confirmation: "Datos encontrados".
array
Array of row objects returned by PostgreSQL. Each object’s keys correspond to the column names of the queried table.

404 — Not Found

Returned when rowCount === 0 (the table exists but contains no rows).
number
404 when no rows are found.
string
"No se encontraron datos"

500 — Internal Server Error

Returned when the query throws (e.g., the table does not exist, a connection error, etc.).
number
500 on an unhandled exception.
string
"Error al obtener los datos"
object
The raw error object thrown by the pg driver. Contains fields such as code, detail, and message from PostgreSQL.

Examples

Example Response — GET /get-data/payment_method


No table allowlist is enforced. The :table parameter is interpolated verbatim into the SQL query as SELECT * FROM {table}. Any caller who can reach this endpoint can query any table in the connected PostgreSQL database, including internal or sensitive tables. Add an explicit allowlist of permitted table names (and parameterised queries or an ORM) before exposing this endpoint in production.