Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tutosrive/factus_challenge/llms.txt

Use this file to discover all available pages before exploring further.

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

GET /get-data/:table

Path Parameters

table
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:
ValueDescription
customerRegistered customers
productsProduct catalogue
payment_methodAvailable payment methods
municipalityColombian municipalities (lookup table)
identification_documentTypes of identification document
legal_organizationLegal organisation types
customer_tributeTax / tribute categories for customers

Responses

200 — OK

Returned when at least one row is found (rowCount > 0).
{
  "status": 200,
  "message": "Datos encontrados",
  "data": [ /* array of row objects */ ]
}
status
number
Always 200 on success.
message
string
Human-readable confirmation: "Datos encontrados".
data
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).
{
  "status": 404,
  "message": "No se encontraron datos"
}
status
number
404 when no rows are found.
message
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.).
{
  "status": 500,
  "message": "Error al obtener los datos",
  "error": { /* pg error object */ }
}
status
number
500 on an unhandled exception.
message
string
"Error al obtener los datos"
error
object
The raw error object thrown by the pg driver. Contains fields such as code, detail, and message from PostgreSQL.

Examples

curl -X GET http://localhost:3000/get-data/customer \
  -H "Accept: application/json"

Example Response — GET /get-data/payment_method

{
  "status": 200,
  "message": "Datos encontrados",
  "data": [
    { "id": 1, "name": "Efectivo", "code": "10" },
    { "id": 2, "name": "Tarjeta crédito", "code": "48" }
  ]
}

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.

Build docs developers (and LLMs) love