# Find absence requests with advanced filtering by several parameters.

Find absence requests in dates range. If you provide more than one value in one filter attribute there is OR relation between them.  For instance: if you put in a filter: {employees: ["john@mycompany.com", "kevin@mycompany.com"]} it returns all John's and all Kevin's requests.When you fill more than one attribute in filter all conditions have to be fulfilled. There is AND relation between attributes. For instance: if you provide in filter {absenceTypes: ["PTO"], teams: ["DevTeam"]} then will be returned PTO requests of employees who are in team DevTeam.Expect error codes:INVALID_DATE_FROM - when invalid time in filter providedINVALID_DATE_TO - when invalid time in filter providedINVALID_EMPLOYEE - when one of provided employees is invalidINVALID_ABSENCE_TYPE - when one of provided absence types is invalidINVALID_TEAM - when one of provided teams is invalidINVALID_POSITION - when one of provided positions is invalidINVALID_CONTRACT_TYPE - when one of provided contract types is invalidINVALID_CREATE_DATE_FROM - when invalid time in filter providedINVALID_CREATE_DATE_TO - when invalid time in filter providedINVALID_CREATE_UPDATE_FROM - when invalid time in filter providedINVALID_CREATE_UPDATE_TO - when invalid time in filter provided

Endpoint: POST /leave/request/v1/find-advanced
Version: v1
Security: basicAuth

## Request fields (application/json):

  - `from` (string, required)
    Start date of dates range to search request in ISO format
    Example: "2017-01-10"

  - `to` (string, required)
    End date of dates range to search request in ISO format
    Example: "2017-01-15"

  - `absenceTypes` (array)
    List of absence types names or identifiers to search. Example: ["Annual Leave", "Remote Work", "Sick Leave"]
    Example: ["Annual Leave"]

  - `teams` (array)
    List of teams names or identifiers to search. As a result there will be absence requests of employees who are members of at least one of provided teams. Example: ["First Team", "Second Team", "Third Team"]
    Example: ["First Team"]

  - `positions` (array)
    List of positions names or identifiers to search. As a result there will be absence requests of employees who have one of provided positions. Example: ["Developer", "Support", "Architect"]
    Example: ["Developer"]

  - `contractTypes` (array)
    List of contract types names or identifiers to search. As a result there will be absence requests of employees who have one of contract type. Example: ["firstContract", "secondContract"]
    Example: ["firstContract"]

  - `employees` (array)
    List of employees e-mails or logins. Example: ["john.smith@domain.com", "mark.small@domain.com"]
    Example: ["john.smith@domain.com"]

  - `createdFrom` (string)
    Filter absence requests by date of creation. As a result there will be absence requests created at the provided moment or later. Please provide the date and time in ISO 8601 format with time zone.
    Example: "2017-01-23T08:00:00+01:00"

  - `createdTo` (string)
    Filter absence requests by date of creation. As a result there will be absence requests created before the provided moment. Please provide the date and time in ISO 8601 format with time zone.
    Example: "2017-01-24T00:00:00+01:00"

  - `updatedFrom` (string)
    Filter absence requests by date of last update. As a result there will be absence requests updated at the provided moment or later. Please provide the date and time in ISO 8601 format with time zone.
    Example: "2017-01-23T08:00:00+01:00"

  - `updatedTo` (string)
    Filter absence requests by date of last update. As a result there will be absence requests updated before the provided moment. Please provide the date and time in ISO 8601 format with time zone.
    Example: "2017-01-24T00:00:00+01:00"

  - `absenceStatuses` (array)
    Filter absence requests by absence statuses. As a result there will be absence requests with chosen statuses. By default return all absence requests. Allowed values: ["PENDING", "PENDING_CANCELLATION", "REJECTED", "APPROVED", "CANCELED", "REVOKED"]
    Example: ["PENDING"]

## Response 200 fields (application/json):

  - `id` (integer, required)
    Absence request ID

  - `from` (string, required)
    Absence start date in ISO format
    Example: "2017-02-20"

  - `to` (string, required)
    Absence finish date in ISO format
    Example: "2017-02-25"

  - `absenceTypeName` (string, required)
    Absence type name
    Example: "Annual leave"

  - `absenceTypeId` (integer, required)
    Absence type ID

  - `absenceCategory` (string, required)
    Absence category. TIMEOFF - regular time off. WORK - when employee is working but is not in office (eg. 'Remote working day')
    Enum: "TIMEOFF", "WORK"

  - `status` (string, required)
    Absence request status
    Enum: "PENDING", "PENDING_CANCELLATION", "REJECTED", "ACCEPTED", "CANCELED", "REVOKED"

  - `entitlementAmount` (number, required)
    Entitlement amount

  - `reason` (string, required)
    Reason for absence

  - `amountFirstDay` (number, required)
    First day amount

  - `amountLastDay` (number, required)
    Last day amount

  - `entitlementAmountUnit` (string, required)
    Entitlement amount unit
    Enum: "DAYS", "HOURS"

  - `created` (string, required)
    Date and time of absence request creation

  - `updated` (string, required)
    Date and time of absence request latest update

  - `fullDayRequest` (boolean, required)
    Has the absence been requested for the whole day?

  - `startTime` (string, required)
    Local start date and start time of absence

  - `endTime` (string, required)
    Local end date and end time of absence

  - `timeZone` (string, required)
    Absence reporter time zone
    Example: "Europe/Warsaw"

  - `hasAttachments` (boolean, required)
    Absence has attachments
    Example: true

  - `employeeEmail` (string)
    Employee email
    Example: "john.white@mycompany.com"

  - `substituteEmail` (string)
    Substitute email. Has null value if employee does not have substitute
    Example: "john.black@mycompany.com"

## Response 400 fields (application/json):

  - `message` (string)
    Human readable error explanation.
    Example: "Api error"

  - `code` (string)
    Error code.
    Example: "INVALID_JSON_PAYLOAD"

  - `field` (string)
    Which field of payload object caused error. NULL when error is not related to particular field
    Example: "field"

## Response 401 fields (application/json):

  - `message` (string, required)
    Error details
    Example: "Authentication failure"

  - `code` (string, required)
    General type of error
    Example: "AUTH"

  - `field` (string)
    Leftover for backward compatibility

## Response 429 fields (application/json):

  - `code` (string, required)
    General type of error
    Example: "QUOTA_EXCEEDED"

  - `field` (string, required)
    Detailed info about quota and it's current usage
    Example: "Your current usage is 101/day, 10/hour, 1/sec\nYour current limits 100/day, 10/hour, 1/sec."

## Response 500 fields (application/json):

  - `message` (string, required)
    Error details
    Example: "An unexpected error occurred"

  - `code` (string, required)
    General type of error
    Example: "INTERNAL_SERVER_ERROR"

## Response 504 fields (application/json):

  - `message` (string, required)
    Error details
    Example: "Public API call exceeded timeout"

  - `code` (string, required)
    General type of error
    Example: "TIMEOUT"


## Response 403 fields
