On this page

This page documents all available request body fields for the `POST /api/incident/search` endpoint. Each property listed below represents a searchable attribute

{
  "id_start": 12000,
  "id_end": 12500,

  "culture": "en-us",

  "reported_by_name": "Jane Smith",
  "reported_by_id": 4321,

  "date_of_report_start": "01/01/2026",
  "date_of_report_end": "01/31/2026",
  "date_of_incident_start": "12/15/2025",
  "date_of_incident_end": "12/31/2025",

  "location_name": "HQ",
  "sublocation_name": "Building A",
  "room_name": "101",

  "status_name": "Open",
  "status_id": 2,

  "priority_name": "High",
  "priority_id": 3,

  "assigned_to_name": "John Doe",
  "assigned_to_id": 9876,

  "duration_total": 2.5,
  "duration_operator": 4,

  "attached_file_count": 1,
  "attached_file_count_operator": 4,

  "report_sponsor_name": "Pat Lee",
  "report_sponsor_id": 55,

  "category_name": "Safety",
  "subcategory_name": "Near Miss",

  "person_name": "Alex Johnson",
  "witness_name": "Morgan Reed",

  "form_name": "Incident Intake",
  "form_id": 10,

  "note_author_name": "Jane Smith",
  "day_of_incident": "Tuesday"
}

How the Search Works#

This section explains how the POST /api/incident/search endpoint evaluates and applies search criteria.

The endpoint accepts:

  • Body
  • Optional query parameters
    • pagesize
    • page
    • sort

1. ID Range Overrides All Other Filters#

If either of the following fields is supplied:

  • id_start
  • id_end

Then all other fields in the request body are ignored.

Behavior

  • If both id_start and id_end are provided:
    • Returns incidents where Incident.IID BETWEEN id_start AND id_end
  • If only one is provided:
    • The system evaluates using the provided bound
  • No other filters (dates, status, location, priority, etc.) are applied

This rule takes precedence over all other search criteria.


2. Date Filtering Rules (When ID Range Is Not Used)#

If no ID range is supplied, date filters are evaluated.

There are two independent date domains:

A. Date of Report

  • date_of_report_start
  • date_of_report_end
  • Filters on: Incident.Tdate (submission date)

B. Date of Incident

  • date_of_incident_start
  • date_of_incident_end
  • Filters on: Incident.Idate (occurrence date)

Date Handling Behavior

Both Start and End Provided

If both start and end dates are supplied:

BETWEEN start_date AND end_date

The system validates that the start date is not after the end date.


Only Start Date Provided

If only the start date is supplied:

  • The end date defaults to today's date
  • Records are returned from the start date through the current date

Conceptually:

BETWEEN start_date AND CURRENT_DATE


Only End Date Provided

If only the end date is supplied:

  • The start date defaults to the earliest available system date
  • Records are returned from the earliest date through the provided end date

Conceptually:

BETWEEN MIN_SYSTEM_DATE AND end_date


Same Start and End Date

If the start and end dates are identical:

  • The system searches that exact calendar day

Combining Report and Incident Dates

The two date domains may be used independently or together.

Usage Pattern Behavior
Report date only Filters by submission date
Incident date only Filters by occurrence date
Both report AND incident dates Both filters must be satisfied

When both are supplied, both conditions must be true.

This is always an AND relationship.


3. All Other Fields Are AND’d Together#

When no ID range is provided:

  • All non-null
  • All non-empty
  • All valid fields

Are combined using logical AND.

There is:

  • No OR logic
  • No NOT logic
  • No partial matches
  • No fuzzy matching

All string comparisons require exact matches.


Example Logical Construction#

If the request includes:

  • Report date range
  • status_name = "Open"
  • priority_name = "High"
  • location_name = "HQ"

Conceptually:

All conditions must be satisfied.


4. Operator-Based Fields#

Duration

Fields:

  • duration_total
  • duration_operator

Operator values:

Value Meaning
0 Equal
1 Less Than
2 Greater Than
3 Less Than or Equal
4 Greater Than or Equal

Example:

duration_total = 2.5 and duration_operator = 4
Means: duration is greater than or equal to 2.5.

If duration_total is null β†’ ignored.


Attached File Count

Fields:

  • attached_file_count
  • attached_file_count_operator

Operator meanings are identical to Duration.

If value is null β†’ ignored.


5. Special Cases#

Report Sponsor

  • report_sponsor_id = 0 β†’ Returns incidents with no sponsor
  • report_sponsor_id = NULL β†’ Ignored

Form

  • form_id = 0 β†’ Returns incidents with no forms attached
  • form_id = NULL β†’ Ignored

6. Execution Order Summary#

Evaluation flow:

  1. If id_start or id_end is provided β†’ apply ONLY ID range filter.
  2. Otherwise:
    • Apply report date filter (if present).
    • Apply incident date filter (if present).
    • Apply all other non-null fields.
    • Combine everything using AND.

7. Behavioral Summary#

  • ID range supersedes all other filters.
  • If only a start date is supplied, the end date defaults to today.
  • If only an end date is supplied, the start date defaults to the earliest system date.
  • Report and incident dates can be combined.
  • All non-ID filters are AND-based.
  • All string matches are exact.
  • NULL values are ignored (except explicit 0 cases).
  • No OR, NOT, or partial matching is supported.