Skip to main content

Endpoint

GET /api/v1/tickets/technician/{technicianId}

Authentication

Requires authentication with ticket:read permission.

Path Parameters

ParameterTypeRequiredDescription
technicianIdstring (UUID)YesID of the technician/admin whose assigned tickets to retrieve

Query Parameters

ParameterTypeRequiredDescription
pagenumberNoPage number for pagination (default: 1)
limitnumberNoNumber of tickets per page (default: 10 for all, 50 for filtered)
sortBystringNoSort field and direction (e.g., “createdAt:desc”)
statusstringNoFilter by status: PENDING, IN_PROGRESS, COMPLETED, or CANCELLED

Request Examples

Get All Technician Tickets (Grouped by Status)

curl -X GET "http://localhost:3001/api/v1/tickets/technician/550e8400-e29b-41d4-a716-446655440000?page=1&limit=10" \
  -H "Cookie: session=your-session-cookie"

Get Technician Tickets by Specific Status

# Get only IN_PROGRESS tickets for a technician
curl -X GET "http://localhost:3001/api/v1/tickets/technician/550e8400-e29b-41d4-a716-446655440000?status=IN_PROGRESS&page=1&limit=20" \
  -H "Cookie: session=your-session-cookie"

# Get only PENDING tickets for a technician
curl -X GET "http://localhost:3001/api/v1/tickets/technician/550e8400-e29b-41d4-a716-446655440000?status=PENDING" \
  -H "Cookie: session=your-session-cookie"

Response

Success Response - All Tickets (200)

Returns all tickets assigned to the technician grouped by status when no status filter is applied:
{
  "PENDING": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "userId": "550e8400-e29b-41d4-a716-446655440001",
      "status": "PENDING",
      "category": "MAINTENANCE",
      "title": "Elevator Malfunction",
      "description": "Elevator not working on floor 3",
      "attachments": ["https://example.com/image1.jpg"],
      "assignedTo": "550e8400-e29b-41d4-a716-446655440004",
      "notes": "Assigned to technician",
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-15T10:30:00Z",
      "user": {
        "id": "550e8400-e29b-41d4-a716-446655440001",
        "fullname": "John Doe",
        "phoneNumber": "+1234567890",
        "profilePhoto": "https://example.com/profile.jpg"
      }
    }
  ],
  "IN_PROGRESS": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440002",
      "userId": "550e8400-e29b-41d4-a716-446655440003",
      "status": "IN_PROGRESS",
      "category": "ELECTRICITY",
      "title": "Power Outage",
      "description": "Power outage in building A",
      "attachments": [],
      "assignedTo": "550e8400-e29b-41d4-a716-446655440004",
      "notes": "Technician dispatched and working on electrical panel",
      "createdAt": "2024-01-15T09:00:00Z",
      "updatedAt": "2024-01-15T11:00:00Z",
      "user": {
        "id": "550e8400-e29b-41d4-a716-446655440003",
        "fullname": "Jane Smith",
        "phoneNumber": "+1234567891",
        "profilePhoto": null
      }
    }
  ],
  "COMPLETED": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440007",
      "userId": "550e8400-e29b-41d4-a716-446655440008",
      "status": "COMPLETED",
      "category": "WATER",
      "title": "Pipe Repair",
      "description": "Fixed leaking pipe in unit 305",
      "attachments": ["https://example.com/before.jpg", "https://example.com/after.jpg"],
      "assignedTo": "550e8400-e29b-41d4-a716-446655440004",
      "notes": "Work completed successfully",
      "createdAt": "2024-01-14T08:00:00Z",
      "updatedAt": "2024-01-14T15:30:00Z",
      "user": {
        "id": "550e8400-e29b-41d4-a716-446655440008",
        "fullname": "Bob Wilson",
        "phoneNumber": "+1234567893",
        "profilePhoto": null
      }
    }
  ],
  "CANCELLED": []
}

Success Response - Filtered by Status (200)

Returns only tickets from the specified status when status filter is applied:
{
  "PENDING": [],
  "IN_PROGRESS": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440002",
      "userId": "550e8400-e29b-41d4-a716-446655440003",
      "status": "IN_PROGRESS",
      "category": "ELECTRICITY",
      "title": "Power Outage",
      "description": "Power outage in building A",
      "attachments": [],
      "assignedTo": "550e8400-e29b-41d4-a716-446655440004",
      "notes": "Technician dispatched and working on electrical panel",
      "createdAt": "2024-01-15T09:00:00Z",
      "updatedAt": "2024-01-15T11:00:00Z",
      "user": {
        "id": "550e8400-e29b-41d4-a716-446655440003",
        "fullname": "Jane Smith",
        "phoneNumber": "+1234567891",
        "profilePhoto": null
      }
    },
    {
      "id": "550e8400-e29b-41d4-a716-446655440009",
      "userId": "550e8400-e29b-41d4-a716-446655440010",
      "status": "IN_PROGRESS",
      "category": "MAINTENANCE",
      "title": "AC Repair",
      "description": "Air conditioning not working",
      "attachments": [],
      "assignedTo": "550e8400-e29b-41d4-a716-446655440004",
      "notes": "Parts ordered, waiting for delivery",
      "createdAt": "2024-01-15T12:00:00Z",
      "updatedAt": "2024-01-15T13:00:00Z",
      "user": {
        "id": "550e8400-e29b-41d4-a716-446655440010",
        "fullname": "Sarah Johnson",
        "phoneNumber": "+1234567894",
        "profilePhoto": "https://example.com/sarah.jpg"
      }
    }
  ],
  "COMPLETED": [],
  "CANCELLED": []
}

No Content Response (204)

{
  "PENDING": [],
  "IN_PROGRESS": [],
  "COMPLETED": [],
  "CANCELLED": []
}

Error Response (400)

{
  "success": false,
  "error": {
    "message": "Invalid technician ID format",
    "code": "VALIDATION_ERROR"
  }
}

Error Response (401)

{
  "success": false,
  "error": {
    "message": "Unauthorized access",
    "code": "UNAUTHORIZED"
  }
}

Error Response (403)

{
  "success": false,
  "error": {
    "message": "Insufficient permissions",
    "code": "FORBIDDEN"
  }
}

Error Response (404)

{
  "success": false,
  "error": {
    "message": "Technician not found",
    "code": "NOT_FOUND"
  }
}

Notes

  • Without Status Filter: Returns up to 10 tickets per page grouped by status
  • With Status Filter: Returns paginated tickets from the specified status only (default: 50 per page)
  • Tickets are automatically grouped by status in the response
  • Each ticket includes user information who created the ticket
  • Technician information is not included since we’re already filtering by technician ID
  • Empty arrays are returned for statuses with no tickets
  • Default sorting is by creation date (newest first)
  • The technicianId parameter must be a valid UUID v4
  • This endpoint is useful for technician workload management and task tracking
  • Only returns tickets where assignedTo matches the provided technician ID