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 builds and executes a UPDATE … SET … WHERE statement against the specified PostgreSQL table. The columns to update and their new values come from the JSON request body; the row(s) to target are identified by the :property and :value URL path parameters. Both PUT and PATCH are mapped to the same controller (update_data) and behave identically — use whichever best matches your client’s semantic intent. The updated row is returned via RETURNING *.

Endpoints

PUT   /update-data/:table/:property/:value
PATCH /update-data/:table/:property/:value
Both methods accept the same path parameters and request body.

Path Parameters

table
string
required
Name of the PostgreSQL table to update. Example: customer, products.
property
string
required
Column name used in the WHERE clause to identify which row(s) to update. Typically a primary key column such as id.
value
string
required
The value that :property must equal for a row to be updated. This is passed as a URL segment and interpolated into the SQL as a string literal: WHERE {property} = '{value}'.

Request Body

Send a JSON object containing only the columns you want to change. The controller calls generate_str_of_dict(data) (with key_value = true, the default) to build the SET clause:
  • String values → column = 'new value'
  • Number values → column = 42
The resulting SQL executed against PostgreSQL is:
UPDATE {table} SET {key=val, ...} WHERE {property} = '{value}' RETURNING *
[column_name]
string | number
Any column that exists in the target table. Include only the fields you want to modify. Example: { "names": "New Name", "email": "[email protected]" }.

Responses

200 — OK

Returned when at least one row was updated (rowCount > 0).
{
  "status": 200,
  "message": "Datos actualizados",
  "updated_fields": { /* updated row object */ }
}
status
number
Always 200 on success.
message
string
"Datos actualizados"
updated_fields
object
The full row after the update, as returned by RETURNING *. Contains all column values — not only the ones that were changed.

404 — Not Found

Returned when rowCount === 0, meaning no rows matched the WHERE condition.
{
  "status": 404,
  "message": "No se actualizaron los datos"
}

500 — Internal Server Error

Returned on any exception thrown by the pg driver (constraint violation, unknown column, connection error, etc.).
{
  "status": 500,
  "message": "Error al actualizar los datos",
  "error": { /* pg error object */ }
}
error
object
Raw error from the pg driver. Check error.code and error.detail for PostgreSQL-level diagnostics.

Examples

curl -X PATCH "http://localhost:3000/update-data/customer/id/42" \
  -H "Content-Type: application/json" \
  -d '{"names": "New Name"}'

Example Response — PATCH /update-data/customer/id/42

{
  "status": 200,
  "message": "Datos actualizados",
  "updated_fields": {
    "id": 42,
    "names": "New Name",
    "address": "Cll. 22 #45C-45",
    "email": "[email protected]",
    "phone": "3001234567",
    "tribute_id": 21,
    "municipality_id": 1041,
    "identification": "1109780065",
    "type_id": 3,
    "id_org": 2
  }
}

SQL injection risk. The :value path segment is interpolated verbatim into the SQL WHERE clause as a string literal (WHERE {property} = '{value}'). A malicious caller can craft a URL such as /update-data/customer/id/0' OR '1'='1 to match unintended rows. Sanitize and validate all path parameters — or switch to parameterised queries ($1, $2, …) — before exposing this endpoint in production.

Build docs developers (and LLMs) love