Skip to main content
POST
/
api
/
serviceRequests
/
getServiceRequests
List Service Requests
curl --request POST \
  --url https://api.example.com/api/serviceRequests/getServiceRequests \
  --header 'Content-Type: application/json' \
  --data '
{
  "requestId": 123,
  "requestuuId": "<string>",
  "customer_id": 123,
  "service_type": 123,
  "delivery_year": 123,
  "delivery_month": 123,
  "delivery_day": 123,
  "created_year": 123,
  "created_month": 123,
  "created_day": 123,
  "include_inactive": true,
  "user_id": 123
}
'
{
  "success": true,
  "solicitudes": [
    {
      "request_id": 123,
      "request_uuid": "<string>",
      "customer_id": 123,
      "contact_name": "<string>",
      "contact_email": "<string>",
      "contact_phone": "<string>",
      "whatsapp": "<string>",
      "service_type": 123,
      "service_type_name": "<string>",
      "current_status": 123,
      "department_id": 123,
      "department_name": "<string>",
      "address": "<string>",
      "requested_delivery_date": "<string>",
      "approved_delivery_date": "<string>",
      "comments": "<string>",
      "created_at": "<string>",
      "created_by": 123,
      "company_name": "<string>",
      "tax_id": "<string>",
      "media_files": [
        {
          "media_id": 123,
          "file_name": "<string>",
          "s3_bucket": "<string>",
          "s3_key": "<string>",
          "s3_url": "<string>",
          "presigned_url": "<string>",
          "public_url": "<string>",
          "content_type": "<string>",
          "file_size": 123
        }
      ],
      "deactivation_reason": "<string>",
      "deactivated_by": "<string>",
      "deactivated_at": "<string>"
    }
  ],
  "error": "<string>"
}

Overview

This endpoint retrieves service requests from the database with comprehensive filtering capabilities. Results include presigned URLs for media files and deactivation information when applicable.

Request Body

requestId
integer
Filter by specific request ID
requestuuId
string
Filter by request UUID
customer_id
integer
Filter by customer ID
service_type
integer
Filter by service type ID
delivery_year
integer
Filter by delivery year
delivery_month
integer
Filter by delivery month (1-12)
delivery_day
integer
Filter by delivery day (1-31)
created_year
integer
Filter by creation year
created_month
integer
Filter by creation month (1-12)
created_day
integer
Filter by creation day (1-31)
include_inactive
boolean
default:"true"
Include deactivated requests (status = -1) in results
user_id
integer
Filter by assigned user/vendor ID

Response Fields

success
boolean
required
Indicates if the request was successful
solicitudes
array
required
Array of service request objects
request_id
integer
Unique request identifier
request_uuid
string
UUID for public-facing request tracking
customer_id
integer
Customer ID associated with the request
contact_name
string
Name of the applicant/contact person
contact_email
string
Email address for contact
contact_phone
string
Phone number for contact
whatsapp
string
WhatsApp number for contact
service_type
integer
Service type ID
service_type_name
string
Human-readable service type name
current_status
integer
Current status of the request
  • -1: Deactivated
  • 1: Created/Pending
  • 2: Sent for review
  • 3: Approved by operations
  • 8: Rejected
department_id
integer
Department ID
department_name
string
Department name
address
string
Service delivery address
requested_delivery_date
string
Requested delivery date (ISO 8601 format)
approved_delivery_date
string
Approved delivery date by operations (ISO 8601 format)
comments
string
Additional comments or notes
created_at
string
Request creation timestamp (ISO 8601 format)
created_by
integer
User ID who created the request
company_name
string
Company name if applicable
tax_id
string
Tax ID (NIT) of the applicant
media_files
array
Array of media files associated with the request
media_id
integer
Media file ID
file_name
string
Original file name
s3_bucket
string
S3 bucket name
s3_key
string
S3 object key
s3_url
string
Public S3 URL
presigned_url
string
Presigned URL valid for 15 minutes (900 seconds)
public_url
string
Public URL for the media file
content_type
string
MIME type of the file
file_size
integer
File size in bytes
deactivation_reason
string
Reason for deactivation (only present when current_status = -1)
deactivated_by
string
User who deactivated the request (only present when current_status = -1)
deactivated_at
string
Deactivation timestamp (only present when current_status = -1)

Status Lifecycle

Service requests follow this status lifecycle:
  1. Status 1 (Created): Initial state when request is created
  2. Status 2 (Sent for Review): Vendor sends request to operations for availability review
  3. Status 3 (Approved): Operations approves request and sets delivery date
  4. Status 8 (Rejected): Request is rejected by client or operations
  5. Status -1 (Deactivated): Request is soft-deleted/deactivated

Example Request

curl -X POST https://api.ambiotec-sa.com/api/serviceRequests/getServiceRequests \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "service_type": 1,
    "delivery_year": 2026,
    "delivery_month": 3,
    "include_inactive": false
  }'

Example Response

{
  "success": true,
  "solicitudes": [
    {
      "request_id": 12345,
      "request_uuid": "550e8400-e29b-41d4-a716-446655440000",
      "customer_id": 789,
      "contact_name": "Juan Pérez",
      "contact_email": "[email protected]",
      "contact_phone": "+502 2345-6789",
      "whatsapp": "+502 5555-1234",
      "service_type": 1,
      "service_type_name": "PTAR Installation",
      "current_status": 3,
      "department_id": 5,
      "department_name": "Guatemala",
      "address": "1a Calle 2-34 Zona 10, Guatemala",
      "requested_delivery_date": "2026-04-15T00:00:00Z",
      "approved_delivery_date": "2026-04-18T00:00:00Z",
      "comments": "Urgent installation required",
      "created_at": "2026-03-01T14:30:00Z",
      "created_by": 42,
      "company_name": "Acme Corp",
      "tax_id": "12345678-9",
      "media_files": [
        {
          "media_id": 567,
          "file_name": "site_photo.jpg",
          "s3_bucket": "ambiotec-media",
          "s3_key": "quotations/12345/mediosynotas/20260301-143000-0.jpg",
          "s3_url": "https://s3.amazonaws.com/ambiotec-media/quotations/12345/mediosynotas/20260301-143000-0.jpg",
          "presigned_url": "https://s3.amazonaws.com/ambiotec-media/quotations/12345/mediosynotas/20260301-143000-0.jpg?X-Amz-Algorithm=...",
          "public_url": "https://s3.amazonaws.com/ambiotec-media/quotations/12345/mediosynotas/20260301-143000-0.jpg",
          "content_type": "image/jpeg",
          "file_size": 245678
        }
      ]
    }
  ]
}

Error Responses

error
string
Error message describing what went wrong

500 Internal Server Error

{
  "error": "Error al obtener las solicitudes de servicio"
}

Notes

  • Media file presigned URLs are valid for 15 minutes (900 seconds)
  • The endpoint uses a database function fn_get_service_requests for filtering
  • When include_inactive is true, deactivated requests (status = -1) will include additional fields: deactivation_reason, deactivated_by, and deactivated_at
  • All date fields are returned in ISO 8601 format

Build docs developers (and LLMs) love