Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AngelZurita28/VeranoRegional/llms.txt

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

api.php exposes a small set of internal JSON endpoints used by registration and admin forms to populate dependent dropdowns without a full page reload. These endpoints are called via client-side fetch or XMLHttpRequest from the same origin — they are not designed for external consumers and carry no authentication layer. A separate AJAX endpoint in ApplicationController handles student application priority reordering.

Base URL

http://localhost/VeranoRegional/api.php?action=<action>
All responses carry a Content-Type: application/json header. Successful requests return HTTP 200; an unrecognised or missing action returns HTTP 400.
These endpoints are for same-origin use only. There is no CORS configuration, so cross-origin requests from a different domain or port will be blocked by the browser.

GET api.php?action=get_careers_by_campus

Returns the list of academic careers associated with a specific campus. Used by registration forms to populate the Career dropdown after a user selects their campus.

Query parameters

action
string
required
Must be get_careers_by_campus.
idCampus
integer
required
The numeric ID of the campus whose careers you want to retrieve.

Response

[]
array
Array of career objects.

Error response

If idCampus is missing or not a numeric value, the endpoint returns HTTP 200 with an error object (not a 4xx status):
{"error": "idCampus no proporcionado o inválido"}

Example

curl "http://localhost/VeranoRegional/api.php?action=get_careers_by_campus&idCampus=12"
[
  {"id": "42", "description": "Ingeniería en Sistemas Computacionales", "idCampus": "12", "status": "1"},
  {"id": "43", "description": "Licenciatura en Matemáticas", "idCampus": "12", "status": "1"}
]

GET api.php?action=get_cities_by_state

Returns the list of cities that belong to a given Mexican state. Used by the campus creation and edit forms to populate the City dropdown.

Query parameters

action
string
required
Must be get_cities_by_state.
idState
integer
required
The numeric ID of the state whose cities you want to retrieve.

Response

[]
array
Array of city objects.

Error response

If idState is missing or not numeric:
{"error": "idState no proporcionado o inválido"}

Example

curl "http://localhost/VeranoRegional/api.php?action=get_cities_by_state&idState=5"
[
  {"id": "101", "description": "Aguascalientes", "idState": "5", "status": "1"},
  {"id": "102", "description": "Calvillo", "idState": "5", "status": "1"}
]

GET api.php?action=get_campuses_by_institution

Returns the campuses that belong to a specific institution. Used by registration and admin forms to cascade the campus dropdown after an institution is selected.

Query parameters

action
string
required
Must be get_campuses_by_institution.
idInstitution
integer
required
The numeric ID of the institution.

Response

[]
array
Array of campus objects. Returns an empty array [] if idInstitution is missing or non-numeric (no error object — this differs from the other two endpoints).

Example

curl "http://localhost/VeranoRegional/api.php?action=get_campuses_by_institution&idInstitution=3"
[
  {"id": "7", "description": "Campus Centro", "campusAbbreviation": "CC", "idInstitution": "3", "idCity": "55", "status": "1"},
  {"id": "8", "description": "Campus Norte", "campusAbbreviation": "CN", "idInstitution": "3", "idCity": "60", "status": "1"}
]

Default / invalid action — HTTP 400

Any request where action is missing, empty, or does not match a known case returns HTTP 400:
{"error": "Acción no válida o no especificada."}
curl -i "http://localhost/VeranoRegional/api.php"
# HTTP/1.1 400 Bad Request
# {"error":"Acción no válida o no especificada."}

POST index.php?action=update_application_order

Updates the priority order of a student’s project applications via AJAX. This endpoint is handled by ApplicationController::updateApplicationOrder() and is routed through index.php, not api.php. It requires an active student session (role 5).
This endpoint requires a valid PHP session. A request without an authenticated session will be redirected to the login page, not return a JSON error.

Request

Method: POST
URL: index.php?action=update_application_order
Content-Type: application/json

Body

order
integer[]
required
Ordered array of application IDs. The position in the array determines the new priority: the first element becomes priority 1, the second becomes priority 2, and so on.
{"order": [14, 9, 22]}

Response

status
string
"success" if the update was applied, "error" otherwise.
message
string
Present only when status is "error". Describes the failure reason.

Example

curl -X POST \
  "http://localhost/VeranoRegional/index.php?action=update_application_order" \
  -H "Content-Type: application/json" \
  -b "PHPSESSID=your_session_id" \
  -d '{"order": [14, 9, 22]}'
{"status": "success"}
Error example:
{"status": "error", "message": "No se pudo actualizar el orden."}

Build docs developers (and LLMs) love