The YourPayroll API supports OData (v3) filtering for most GET operations.

OData Query Parameters

The following OData query parameters are supported. Please note that $expand is not supported.

  • $skip: number of results to skip. e.g.: to skip the first 20 results: $skip=20
  • $top: number of results to retrieve. e.g.: to retrieve the first 10 results: $top=10
  • $orderby: specify the field(s) used to order the collection of results.
  • $select: specify a subset of properties to return. Note that $select is only currently supported for the Employee API.
  • $filter: filter on field values. e.g.: $filter=FirstName eq 'Paul'
    • NOTE: property names for filtering are capitalised. This is different to the camelCase property names returned in the JSON results
    • See the Microsoft documentation on $filter for more information on available filter operations.

Refer to the Microsoft documentation for more information about OData query parameters.

Examples

Paging

The employee list API limits the number of results to 100 per request. To retrieve all results, paging must be implemented:

  • retrieve first 100 records: /api/v2/business/{id}/employee/unstructured?$skip=0&$top=100
  • retrieve the next 100 records: /api/v2/business/{id}/employee/unstructured?$skip=100&$top=100
  • etc

Filtering

  • The following query would return all pay categories that have a default super rate that is not 9.5% /api/v2/business/39/paycategory?$filter=DefaultSuperRate ne 9.5M (note the 'M' is required in '9.5M' to specify the value as a decimal)
  • The following query would return timesheets that start after 1/4/2016 /api/v2/business/39/timesheet?$filter=StartTime gt datetime'2016-04-01T00:00:00'

Ordering

  • The following query would return work types ordered by name /api/v2/business/39/worktype?$orderby=Name

Subset of properties

The following query would return the Id, First name, Surname and date of birth (the first 100) employees * /api/v2/business/{id}/employee/unstructured?$select=Id,FirstName,Surname,DateOfBirth