Formularios — Endpoints de consulta
Forms — Query Endpoints
Los endpoints de formularios permiten consultar datos almacenados en los formularios dinámicos del sistema. La mayoría son públicos (AllowAny), pero el formulario debe tener habilitado el flag for_can_api=True para ser consultable externamente.
for_can_api en el panel de Django Admin. Los formularios sin este flag retornan 403 Forbidden.
GET getInformacion — Última acción de un ente
Retorna la última acción registrada (FormularioAccion) de una entidad específica dentro de un formulario. Requiere autenticación JWT.
| Propiedad | Valor |
|---|---|
| Método | POST |
| Ruta | /home/api/getInformacion |
| Autenticación | JWT requerido |
| Campo (body) | Tipo | Descripción |
|---|---|---|
Formulario | string | Código del formulario (for_codigo) |
Llave | string (UUID) | Valor de la llave primaria del ente |
POST /home/api/getInformacion
Authorization: Bearer <access_token>
Content-Type: application/json
{
"Formulario": "CARACT_01",
"Llave": "12345678"
}
headers = {"Authorization": f"Bearer {access_token}"}
resp = requests.post(
"https://TU-DOMINIO/home/api/getInformacion",
headers=headers,
json={"Formulario": "CARACT_01", "Llave": "12345678"}
)
data = resp.json()
const response = await axios.post(
'https://TU-DOMINIO/home/api/getInformacion',
{ Formulario: 'CARACT_01', Llave: '12345678' },
{ headers: { 'Authorization': `Bearer ${accessToken}` } }
);
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", accessToken);
var body = new StringContent(
JsonSerializer.Serialize(new { Formulario = "CARACT_01", Llave = "12345678" }),
Encoding.UTF8, "application/json"
);
var response = await client.PostAsync(
"https://TU-DOMINIO/home/api/getInformacion", body);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://TU-DOMINIO/home/api/getInformacion"))
.header("Authorization", "Bearer " + accessToken)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(
"{\"Formulario\":\"CARACT_01\",\"Llave\":\"12345678\"}"
))
.build();
Response 200:
{
"msg": "Petición exitosa",
"datos": { "campo_1": "valor_1", "campo_2": "valor_2" }
}
Response 404: {"msg": "No existe una entidad con el filtro asociado"}
GET getInformacionFormulario — Todos los entes (actual)
Retorna todos los entes registrados en un formulario con sus datos más recientes. Los campos de selección se serializan mostrando el texto legible (no el código interno).
| Propiedad | Valor |
|---|---|
| Método | GET |
| Ruta | /home/api/getInformacionFormulario/<codigo> |
| Autenticación | No requerida |
| Requiere | for_can_api=True en el formulario |
GET /home/api/getInformacionFormulario/CARACT_01
import requests
resp = requests.get("https://TU-DOMINIO/home/api/getInformacionFormulario/CARACT_01")
data = resp.json()
const { data } = await axios.get(
'https://TU-DOMINIO/home/api/getInformacionFormulario/CARACT_01'
);
var response = await client.GetAsync(
"https://TU-DOMINIO/home/api/getInformacionFormulario/CARACT_01");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://TU-DOMINIO/home/api/getInformacionFormulario/CARACT_01"))
.GET()
.build();
Response 200:
{
"msg": "Petición exitosa",
"formulario": "Caracterización 2024",
"datos": [
{
"id": 1,
"fecha_registro": "2024-03-15T10:30:00Z",
"PRE_NOMBRE": {"pregunta": "Nombre completo", "respuesta": "Juan Pérez"},
"PRE_BARRIO": {"pregunta": "Barrio", "respuesta": "El Centro"}
}
]
}
Response 403: {"msg": "El formulario no tiene habilitada la consulta por API"}
GET getInformacionFormularioHistoria — Historia de acciones
Retorna todas las acciones registradas sobre un formulario, en orden cronológico. Cada registro incluye el estado de los campos en el momento de la acción. Útil para auditoría.
| Propiedad | Valor |
|---|---|
| Método | GET |
| Ruta | /home/api/getInformacionFormularioHistoria/<codigo> |
| Autenticación | No requerida |
| Requiere | for_can_api=True en el formulario |
GET /home/api/getInformacionFormularioHistoria/CARACT_01
import requests
resp = requests.get(
"https://TU-DOMINIO/home/api/getInformacionFormularioHistoria/CARACT_01"
)
data = resp.json()
const { data } = await axios.get(
'https://TU-DOMINIO/home/api/getInformacionFormularioHistoria/CARACT_01'
);
var response = await client.GetAsync(
"https://TU-DOMINIO/home/api/getInformacionFormularioHistoria/CARACT_01");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://TU-DOMINIO/home/api/getInformacionFormularioHistoria/CARACT_01"))
.GET()
.build();
Response 200:
{
"msg": "Petición exitosa",
"formulario": "Caracterización 2024",
"datos": [
{
"id": 42,
"ente_llave": {"campo_llave": "12345678"},
"fecha_registro": "2024-03-15T10:30:00Z",
"PRE_NOMBRE": {"pregunta": "Nombre completo", "respuesta": "Juan Pérez"},
"PRE_ESTADO": {"pregunta": "Estado", "respuesta": "Activo"}
}
]
}
GET v2/getInformacionFormularioHistoria — Historia V2 (optimizada)
Versión optimizada del endpoint de historia. Pre-carga los valores de maestros una sola vez antes del loop principal, reduciendo queries N+1 en formularios con preguntas de tipo selección maestro. Recomendada para grandes volúmenes.
| Propiedad | Valor |
|---|---|
| Método | GET |
| Ruta | /home/api/v2/getInformacionFormularioHistoria/<codigo> |
| Autenticación | No requerida |
| Requiere | for_can_api=True en el formulario |
iterator(chunk_size=500) para datasets grandes.
GET /home/api/v2/getInformacionFormularioHistoria/CARACT_01
import requests
resp = requests.get(
"https://TU-DOMINIO/home/api/v2/getInformacionFormularioHistoria/CARACT_01"
)
data = resp.json()
const { data } = await axios.get(
'https://TU-DOMINIO/home/api/v2/getInformacionFormularioHistoria/CARACT_01'
);
var response = await client.GetAsync(
"https://TU-DOMINIO/home/api/v2/getInformacionFormularioHistoria/CARACT_01");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://TU-DOMINIO/home/api/v2/getInformacionFormularioHistoria/CARACT_01"))
.GET()
.build();
Response 200 — misma forma que v1 pero claves son el texto de la pregunta:
{
"msg": "Petición exitosa",
"formulario": "Caracterización 2024",
"datos": [
{
"id": 42,
"ente_llave": {"campo_llave": "12345678"},
"fecha_registro": "2024-03-15T10:30:00Z",
"Nombre completo": "Juan Pérez",
"Barrio de residencia": "El Centro"
}
]
}
GET getInformacionNotSerialized — Historia sin serializar
Retorna la historia de acciones con los datos crudos tal como están almacenados en la BD, sin resolver códigos de selección ni aplicar serialización de tipos. Útil para exportaciones o depuración.
| Propiedad | Valor |
|---|---|
| Método | GET |
| Ruta | /home/api/getInformacionNotSerialized/<codigo> |
| Autenticación | No requerida |
| Requiere | for_can_api=True en el formulario |
GET /home/api/getInformacionNotSerialized/CARACT_01
import requests
resp = requests.get(
"https://TU-DOMINIO/home/api/getInformacionNotSerialized/CARACT_01"
)
data = resp.json()
const { data } = await axios.get(
'https://TU-DOMINIO/home/api/getInformacionNotSerialized/CARACT_01'
);
var response = await client.GetAsync(
"https://TU-DOMINIO/home/api/getInformacionNotSerialized/CARACT_01");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://TU-DOMINIO/home/api/getInformacionNotSerialized/CARACT_01"))
.GET()
.build();
Response 200:
{
"msg": "Petición exitosa",
"formulario": "Caracterización 2024",
"datos": [
{
"id": 42,
"ente_llave": {"PRE_DOC": "12345678"},
"fecha_registro": "2024-03-15T10:30:00Z",
"data": {"PRE_NOMBRE": "Juan Pérez", "PRE_BARRIO": "001"},
"data_form": {"CARACT_01": {"PRE_NOMBRE": "Juan Pérez"}}
}
]
}
GET getInformacionTramite — Registros de un trámite
Retorna todos los registros (TramiteEntidad) asociados a un trámite, con sus campos serializados. Si el trámite tiene tra_isDenuncia=True, incluye campos de tipo denuncia (comentarios, reasignaciones, estado).
| Propiedad | Valor |
|---|---|
| Método | GET |
| Ruta | /home/api/getInformacionTramite/<codigo> |
| Autenticación | No requerida |
| Campo respuesta | Descripción |
|---|---|
id | ID del registro TramiteEntidad |
fecha_registro | Fecha de creación |
fecha_radicado | Fecha de radicación (si aplica) |
verificado | Boolean — si el trámite fue verificado |
estado_denuncia | verificada / finalizada / pendiente |
comentarios_tramite | Array de comentarios (si existen) |
reasignacion | Array de reasignaciones (si existen) |
tipo_denuncia_real | Nombre del tipo de denuncia asignado |
| <texto_pregunta> | Valor serializado de cada campo del formulario |
GET /home/api/getInformacionTramite/TRAMITE_PQRS
import requests
resp = requests.get(
"https://TU-DOMINIO/home/api/getInformacionTramite/TRAMITE_PQRS"
)
registros = resp.json() # lista de TramiteEntidad
const { data } = await axios.get(
'https://TU-DOMINIO/home/api/getInformacionTramite/TRAMITE_PQRS'
);
var response = await client.GetAsync(
"https://TU-DOMINIO/home/api/getInformacionTramite/TRAMITE_PQRS");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://TU-DOMINIO/home/api/getInformacionTramite/TRAMITE_PQRS"))
.GET()
.build();
Response 200 — array de registros:
[
{
"id": 15,
"fecha_registro": "2024-03-10T08:00:00Z",
"fecha_radicado": null,
"verificado": false,
"estado_denuncia": "pendiente",
"Nombre del solicitante": "María García",
"Tipo de solicitud": "Petición"
}
]
Form endpoints allow querying data stored in the system's dynamic forms. Most are public (AllowAny), but the form must have the for_can_api=True flag enabled to be externally queryable.
for_can_api flag in the Django Admin panel. Forms without this flag return 403 Forbidden.
POST getInformacion — Last action for an entity
Returns the last recorded action (FormularioAccion) for a specific entity in a form. Requires JWT authentication.
| Property | Value |
|---|---|
| Method | POST |
| Path | /home/api/getInformacion |
| Authentication | JWT required |
| Field (body) | Type | Description |
|---|---|---|
Formulario | string | Form code (for_codigo) |
Llave | string (UUID) | Entity's primary key value |
POST /home/api/getInformacion
Authorization: Bearer <access_token>
Content-Type: application/json
{
"Formulario": "CARACT_01",
"Llave": "12345678"
}
headers = {"Authorization": f"Bearer {access_token}"}
resp = requests.post(
"https://YOUR-DOMAIN/home/api/getInformacion",
headers=headers,
json={"Formulario": "CARACT_01", "Llave": "12345678"}
)
data = resp.json()
const response = await axios.post(
'https://YOUR-DOMAIN/home/api/getInformacion',
{ Formulario: 'CARACT_01', Llave: '12345678' },
{ headers: { 'Authorization': `Bearer ${accessToken}` } }
);
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", accessToken);
var body = new StringContent(
JsonSerializer.Serialize(new { Formulario = "CARACT_01", Llave = "12345678" }),
Encoding.UTF8, "application/json"
);
var response = await client.PostAsync(
"https://YOUR-DOMAIN/home/api/getInformacion", body);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://YOUR-DOMAIN/home/api/getInformacion"))
.header("Authorization", "Bearer " + accessToken)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(
"{\"Formulario\":\"CARACT_01\",\"Llave\":\"12345678\"}"
))
.build();
Response 200:
{
"msg": "Petición exitosa",
"datos": { "field_1": "value_1", "field_2": "value_2" }
}
Response 404: {"msg": "No existe una entidad con el filtro asociado"}
GET getInformacionFormulario — All entities (current state)
Returns all entities registered in a form with their most recent data. Selection fields are serialized showing human-readable text (not internal codes).
| Property | Value |
|---|---|
| Method | GET |
| Path | /home/api/getInformacionFormulario/<codigo> |
| Authentication | Not required |
| Requires | for_can_api=True on the form |
GET /home/api/getInformacionFormulario/CARACT_01
import requests
resp = requests.get("https://YOUR-DOMAIN/home/api/getInformacionFormulario/CARACT_01")
data = resp.json()
const { data } = await axios.get(
'https://YOUR-DOMAIN/home/api/getInformacionFormulario/CARACT_01'
);
var response = await client.GetAsync(
"https://YOUR-DOMAIN/home/api/getInformacionFormulario/CARACT_01");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://YOUR-DOMAIN/home/api/getInformacionFormulario/CARACT_01"))
.GET()
.build();
Response 200:
{
"msg": "Petición exitosa",
"formulario": "Characterization 2024",
"datos": [
{
"id": 1,
"fecha_registro": "2024-03-15T10:30:00Z",
"PRE_NAME": {"pregunta": "Full name", "respuesta": "Juan Pérez"},
"PRE_NEIGHBORHOOD": {"pregunta": "Neighborhood", "respuesta": "El Centro"}
}
]
}
Response 403: {"msg": "El formulario no tiene habilitada la consulta por API"}
GET getInformacionFormularioHistoria — Action history
Returns all recorded actions for a form in chronological order. Each record includes the field state at the time of the action. Useful for auditing.
| Property | Value |
|---|---|
| Method | GET |
| Path | /home/api/getInformacionFormularioHistoria/<codigo> |
| Authentication | Not required |
| Requires | for_can_api=True on the form |
GET /home/api/getInformacionFormularioHistoria/CARACT_01
import requests
resp = requests.get(
"https://YOUR-DOMAIN/home/api/getInformacionFormularioHistoria/CARACT_01"
)
data = resp.json()
const { data } = await axios.get(
'https://YOUR-DOMAIN/home/api/getInformacionFormularioHistoria/CARACT_01'
);
var response = await client.GetAsync(
"https://YOUR-DOMAIN/home/api/getInformacionFormularioHistoria/CARACT_01");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://YOUR-DOMAIN/home/api/getInformacionFormularioHistoria/CARACT_01"))
.GET()
.build();
Response 200:
{
"msg": "Petición exitosa",
"formulario": "Characterization 2024",
"datos": [
{
"id": 42,
"ente_llave": {"campo_llave": "12345678"},
"fecha_registro": "2024-03-15T10:30:00Z",
"PRE_NOMBRE": {"pregunta": "Full name", "respuesta": "Juan Pérez"},
"PRE_ESTADO": {"pregunta": "Status", "respuesta": "Active"}
}
]
}
GET v2/getInformacionFormularioHistoria — History V2 (optimized)
Optimized version of the history endpoint. Pre-loads master data values once before the main loop, reducing N+1 queries on forms with master-selection questions. Recommended for large datasets.
| Property | Value |
|---|---|
| Method | GET |
| Path | /home/api/v2/getInformacionFormularioHistoria/<codigo> |
| Authentication | Not required |
| Requires | for_can_api=True on the form |
iterator(chunk_size=500) for large datasets.
GET /home/api/v2/getInformacionFormularioHistoria/CARACT_01
import requests
resp = requests.get(
"https://YOUR-DOMAIN/home/api/v2/getInformacionFormularioHistoria/CARACT_01"
)
data = resp.json()
const { data } = await axios.get(
'https://YOUR-DOMAIN/home/api/v2/getInformacionFormularioHistoria/CARACT_01'
);
var response = await client.GetAsync(
"https://YOUR-DOMAIN/home/api/v2/getInformacionFormularioHistoria/CARACT_01");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://YOUR-DOMAIN/home/api/v2/getInformacionFormularioHistoria/CARACT_01"))
.GET()
.build();
Response 200 — keys are question text, not codes:
{
"msg": "Petición exitosa",
"formulario": "Characterization 2024",
"datos": [
{
"id": 42,
"ente_llave": {"campo_llave": "12345678"},
"fecha_registro": "2024-03-15T10:30:00Z",
"Full name": "Juan Pérez",
"Neighborhood": "El Centro"
}
]
}
GET getInformacionNotSerialized — Raw history
Returns action history with raw data as stored in the database, without resolving selection codes or applying type serialization. Useful for exports or debugging.
| Property | Value |
|---|---|
| Method | GET |
| Path | /home/api/getInformacionNotSerialized/<codigo> |
| Authentication | Not required |
| Requires | for_can_api=True on the form |
GET /home/api/getInformacionNotSerialized/CARACT_01
import requests
resp = requests.get(
"https://YOUR-DOMAIN/home/api/getInformacionNotSerialized/CARACT_01"
)
data = resp.json()
const { data } = await axios.get(
'https://YOUR-DOMAIN/home/api/getInformacionNotSerialized/CARACT_01'
);
var response = await client.GetAsync(
"https://YOUR-DOMAIN/home/api/getInformacionNotSerialized/CARACT_01");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://YOUR-DOMAIN/home/api/getInformacionNotSerialized/CARACT_01"))
.GET()
.build();
Response 200:
{
"msg": "Petición exitosa",
"formulario": "Characterization 2024",
"datos": [
{
"id": 42,
"ente_llave": {"PRE_DOC": "12345678"},
"fecha_registro": "2024-03-15T10:30:00Z",
"data": {"PRE_NOMBRE": "Juan Pérez", "PRE_BARRIO": "001"},
"data_form": {"CARACT_01": {"PRE_NOMBRE": "Juan Pérez"}}
}
]
}
GET getInformacionTramite — Procedure records
Returns all records (TramiteEntidad) associated with a procedure, with serialized fields. If the procedure has tra_isDenuncia=True, it includes complaint-type fields (comments, reassignments, status).
| Property | Value |
|---|---|
| Method | GET |
| Path | /home/api/getInformacionTramite/<codigo> |
| Authentication | Not required |
| Response field | Description |
|---|---|
id | ID of the TramiteEntidad record |
fecha_registro | Creation date |
fecha_radicado | Filing date (if applicable) |
verificado | Boolean — whether the procedure was verified |
estado_denuncia | verificada / finalizada / pendiente |
comentarios_tramite | Array of comments (if any) |
reasignacion | Array of reassignments (if any) |
tipo_denuncia_real | Name of the assigned complaint type |
| <question_text> | Serialized value of each form field |
GET /home/api/getInformacionTramite/TRAMITE_PQRS
import requests
resp = requests.get(
"https://YOUR-DOMAIN/home/api/getInformacionTramite/TRAMITE_PQRS"
)
records = resp.json() # list of TramiteEntidad
const { data } = await axios.get(
'https://YOUR-DOMAIN/home/api/getInformacionTramite/TRAMITE_PQRS'
);
var response = await client.GetAsync(
"https://YOUR-DOMAIN/home/api/getInformacionTramite/TRAMITE_PQRS");
var json = await response.Content.ReadAsStringAsync();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://YOUR-DOMAIN/home/api/getInformacionTramite/TRAMITE_PQRS"))
.GET()
.build();
Response 200 — array of records:
[
{
"id": 15,
"fecha_registro": "2024-03-10T08:00:00Z",
"fecha_radicado": null,
"verificado": false,
"estado_denuncia": "pendiente",
"Full name of applicant": "María García",
"Request type": "Petition"
}
]