Skip to main content

Get Trip by ID

GET /viajes/get_trip.php
Retrieve detailed information about a specific trip.

Query Parameters

trip_id
integer
required
Trip ID to retrieve

Response

success
boolean
Request success status
trip
object
Complete trip information

Request Example

cURL
curl -X GET "https://76.13.114.194/viajes/get_trip.php?trip_id=789" \
  -H "Accept: application/json"

Response Example

{
  "success": true,
  "trip": {
    "id": 789,
    "usuario_id": 456,
    "conductor_id": 25,
    "tipo_servicio": "motocicleta",
    "estado": "en_curso",
    "origen": {
      "direccion": "Carrera 15 #85-30, Bogotá",
      "latitud": 4.6814,
      "longitud": -74.0479
    },
    "destino": {
      "direccion": "Calle 72 #10-20, Bogotá",
      "latitud": 4.6533,
      "longitud": -74.0602
    },
    "precio_estimado": 18500,
    "distancia_km": 4.2,
    "fecha_solicitud": "2024-03-15T14:30:00.000Z",
    "fecha_aceptacion": "2024-03-15T14:32:00.000Z",
    "fecha_inicio": "2024-03-15T14:40:00.000Z"
  }
}

Accept Trip (Driver)

POST /viajes/accept_trip.php
Driver accepts a trip request.

Request Body

trip_id
integer
required
Trip ID to accept
conductor_id
integer
required
Driver ID accepting the trip

Response

success
boolean
Acceptance success status
trip
object
Updated trip with driver assigned

Request Example

cURL
curl -X POST https://76.13.114.194/viajes/accept_trip.php \
  -H "Content-Type: application/json" \
  -d '{
    "trip_id": 789,
    "conductor_id": 25
  }'

Start Trip (Driver)

POST /viajes/start_trip.php
Mark the trip as started after passenger pickup.

Request Body

trip_id
integer
required
Trip ID to start

Response

success
boolean
Start success status
trip
object
Updated trip with status “en_curso”

Request Example

cURL
curl -X POST https://76.13.114.194/viajes/start_trip.php \
  -H "Content-Type: application/json" \
  -d '{"trip_id": 789}'

Complete Trip (Driver)

POST /viajes/complete_trip.php
Mark the trip as completed and set final price.

Request Body

trip_id
integer
required
Trip ID to complete
precio_final
number
required
Final trip price in COP
distancia_real
number
Actual distance traveled in kilometers

Response

success
boolean
Completion success status
trip
object
Completed trip with final price

Request Example

cURL
curl -X POST https://76.13.114.194/viajes/complete_trip.php \
  -H "Content-Type: application/json" \
  -d '{
    "trip_id": 789,
    "precio_final": 19000,
    "distancia_real": 4.5
  }'

Cancel Trip

POST /viajes/cancel_trip.php
Cancel a trip. Can be called by passenger or driver.

Request Body

trip_id
integer
required
Trip ID to cancel
motivo
string
required
Cancellation reasonCommon reasons:
  • Usuario no encontrado
  • Cambio de planes
  • Tiempo de espera excesivo
  • Conductor no disponible
  • Emergencia

Response

success
boolean
Cancellation success status
trip
object
Cancelled trip with cancellation reason

Request Example

curl -X POST https://76.13.114.194/viajes/cancel_trip.php \
  -H "Content-Type: application/json" \
  -d '{
    "trip_id": 789,
    "motivo": "Cambio de planes"
  }'

Rate Driver (Passenger)

POST /viajes/rate_conductor.php
Rate the driver after trip completion.

Request Body

trip_id
integer
required
Completed trip ID
calificacion
integer
required
Rating from 1 to 5 stars
comentario
string
Optional review comment

Request Example

cURL
curl -X POST https://76.13.114.194/viajes/rate_conductor.php \
  -H "Content-Type: application/json" \
  -d '{
    "trip_id": 789,
    "calificacion": 5,
    "comentario": "Excelente conductor, muy amable"
  }'

Rate Passenger (Driver)

POST /viajes/rate_user.php
Rate the passenger after trip completion.

Request Body

trip_id
integer
required
Completed trip ID
calificacion
integer
required
Rating from 1 to 5 stars
comentario
string
Optional review comment

Request Example

cURL
curl -X POST https://76.13.114.194/viajes/rate_user.php \
  -H "Content-Type: application/json" \
  -d '{
    "trip_id": 789,
    "calificacion": 5,
    "comentario": "Pasajero puntual y respetuoso"
  }'

Trip Status Values

pendiente
status
Trip created, waiting for driver
aceptado
status
Driver assigned, on the way to pickup
en_ruta
status
Driver en route to passenger location
en_curso
status
Passenger picked up, trip in progress
completado
status
Trip successfully completed
cancelado
status
Trip cancelled by passenger or driver

Error Responses

400
Bad Request
Invalid parameters or trip already in final state
404
Not Found
Trip not found
500
Internal Server Error
Server error

See Also

Build docs developers (and LLMs) love