Timesheets


Overview

URL https://api.xero.com/payroll.xro/1.0/Timesheets
Methods Supported POST, GET
Description Allows you to retrieve, add and update Payroll Timesheet in a Xero organisation
Allows you to retrieve, add and update Payroll Timesheet Lines in a Xero organisation.

Elements for Timesheets

The following are required to create a new timesheet
EmployeeID The Xero identifier for an employee
StartDate Period start date (YYYY-MM-DD)
EndDate Period end date (YYYY-MM-DD)
The following are optional when creating a timesheet
TimesheetLines See TimesheetLines
Status See Timesheet Status Codes
Other timesheet elements
Hours Timesheet total hours
TimesheetID The Xero identifier for a Payroll Timesheet

Elements for TimesheetLines

EarningsRateID The Xero identifier for an Earnings Rate
TrackingItemID The Xero identifier for a Tracking Category <TrackingOptionID>. The <TrackingOptionID> must belong to the TrackingCategory selected as <TimesheetCategories> under Payroll Settings.
NumberOfUnits Number of units of a Timesheet line

GET Timesheets

Optional parameters for GET Timesheets

Record filter You can specify an individual record by appending the value to the endpoint, i.e.
GET https://…/Timesheets/{identifier}
TimesheetID The Xero identifier for a payroll timesheet
e.g. 297c2dc5-cc47-4afd-0000-74990b8761e9
Modified After The ModifiedAfter filter is actually an HTTP header: ‘If-Modified-Since‘.
A UTC timestamp (yyyy-mm-ddThh:mm:ss) . Only employees created or modified since this timestamp will be returned e.g. 2009-11-12T00:00:00
page By default the number of records returned per call is 100. You can add GET https://…/Timesheets?page=2 to get the next set of records.
Where Filter by an any element (see Filters)
order Order by any element returned (see Order By)

Example response for GET Timesheets/{identifier}

<Timesheet>  
    <TimesheetID>049765fc-4506-48fb-bf88-3578dec0ec47</TimesheetID>  
    <EmployeeID>72a0d0c2-0cf8-4f0b-ade1-33231f47b41b</EmployeeID>  
    <StartDate>2013-02-01T00:00:00</StartDate>  
    <EndDate>2013-02-07T00:00:00</EndDate>  
    <Status>Processed</Status>  
    <Hours>31.0000</Hours>  
    <TimesheetLines>  
      <TimesheetLine>  
        <EarningsRateID>966c5c77-2ef0-4320-b6a9-6c27b080ecc5</EarningsRateID>  
        <NumberOfUnits>  
          <NumberOfUnit>7.00</NumberOfUnit>  
          <NumberOfUnit>6.00</NumberOfUnit>  
          <NumberOfUnit>6.00</NumberOfUnit>  
          <NumberOfUnit>5.00</NumberOfUnit>  
          <NumberOfUnit>0.00</NumberOfUnit>  
          <NumberOfUnit>0.00</NumberOfUnit>  
          <NumberOfUnit>0.00</NumberOfUnit>  
        </NumberOfUnits>  
        <UpdatedDateUTC>2013-03-21T20:14:28</UpdatedDateUTC>  
      </TimesheetLine>  
      <TimesheetLine>  
        <EarningsRateID>677b6175-dc1c-4255-99e2-157117ae5bcc</EarningsRateID>  
        <NumberOfUnits>  
          <NumberOfUnit>3.00</NumberOfUnit>  
          <NumberOfUnit>4.00</NumberOfUnit>  
          <NumberOfUnit>0.00</NumberOfUnit>  
          <NumberOfUnit>0.00</NumberOfUnit>  
          <NumberOfUnit>0.00</NumberOfUnit>  
          <NumberOfUnit>0.00</NumberOfUnit>  
          <NumberOfUnit>0.00</NumberOfUnit>  
        </NumberOfUnits>  
        <UpdatedDateUTC>2013-03-21T20:14:28</UpdatedDateUTC>  
      </TimesheetLine>  
    </TimesheetLines>  
    <UpdatedDateUTC>2013-03-21T20:14:28</UpdatedDateUTC>  
</Timesheet>  

Example response for GET Timesheets

<Timesheets>  
    <Timesheet>  
      <TimesheetID>049765fc-4506-48fb-bf88-3578dec0ec47</TimesheetID>  
      <EmployeeID>72a0d0c2-0cf8-4f0b-ade1-33231f47b41b</EmployeeID>  
      <StartDate>2013-02-01T00:00:00Z</StartDate>  
      <EndDate>2013-02-07T00:00:00Z</EndDate>  
      <Status>Processed</Status>  
      <Hours>31.0000</Hours>  
      <TimesheetLines>  
        <TimesheetLine>  
          <EarningsRateID>966c5c77-2ef0-4320-b6a9-6c27b080ecc5</EarningsRateID>  
          <NumberOfUnits>  
            <NumberOfUnit>7.00</NumberOfUnit>  
            <NumberOfUnit>6.00</NumberOfUnit>  
            <NumberOfUnit>6.00</NumberOfUnit>  
            <NumberOfUnit>5.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
          </NumberOfUnits>  
          <UpdatedDateUTC>2013-03-21T20:14:28</UpdatedDateUTC>  
        </TimesheetLine>  
        <TimesheetLine>  
          <EarningsRateID>677b6175-dc1c-4255-99e2-157117ae5bcc</EarningsRateID>  
          <NumberOfUnits>  
            <NumberOfUnit>3.00</NumberOfUnit>  
            <NumberOfUnit>4.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
          </NumberOfUnits>  
          <UpdatedDateUTC>2013-03-21T20:14:28</UpdatedDateUTC>  
        </TimesheetLine>  
      </TimesheetLines>  
      <UpdatedDateUTC>2013-03-21T20:14:28</UpdatedDateUTC>  
    </Timesheet>  
    <Timesheet>  
      <TimesheetID>6ab1c708-a958-4788-8aa6-9a1d1a660900</TimesheetID>  
      <EmployeeID>72a0d0c2-0cf8-4f0b-ade1-33231f47b41b</EmployeeID>  
      <StartDate>2013-02-08T00:00:00Z</StartDate>  
      <EndDate>2013-02-14T00:00:00Z</EndDate>  
      <Status>Processed</Status>  
      <Hours>30.0000</Hours>  
      <TimesheetLines>  
        <TimesheetLine>  
          <EarningsRateID>966c5c77-2ef0-4320-b6a9-6c27b080ecc5</EarningsRateID>  
          <NumberOfUnits>  
            <NumberOfUnit>8.00</NumberOfUnit>  
            <NumberOfUnit>8.00</NumberOfUnit>  
            <NumberOfUnit>8.00</NumberOfUnit>  
            <NumberOfUnit>6.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
            <NumberOfUnit>0.00</NumberOfUnit>  
          </NumberOfUnits>  
          <UpdatedDateUTC>2013-03-21T20:14:28</UpdatedDateUTC>  
        </TimesheetLine>  
      </TimesheetLines>  
      <UpdatedDateUTC>2013-03-21T20:14:28</UpdatedDateUTC>  
    </Timesheet>  
</Timesheets>  

POST Timesheets

Use this method to add, update one or more payroll timesheet in payroll.

Example of minimum elements required to add a new Timesheet

<Timesheets>  
  <Timesheet>      
    <EmployeeID>773d4e68-5b38-4181-bcca-8a8fc5c8e756</EmployeeID>  
    <StartDate>2013-01-14</StartDate>  
    <EndDate>2013-01-20</EndDate>  
    <Status>Draft</Status>      
  </Timesheet>  
</Timesheets> 

Example of adding a timesheet with lines

<Timesheets>  
  <Timesheet>   
    <EmployeeID>5e493b2e-c3ed-4172-95b2-593438101f76</EmployeeID>  
    <StartDate>2013-04-03</StartDate>  
    <EndDate>2013-04-10</EndDate>  
    <Status>Draft</Status>  
    <TimesheetLines>  
        <TimesheetLine>  
            <EarningsRateID>0daff504-2d42-4243-bdac-24f2bae0ce7c</EarningsRateID>  
            <NumberOfUnits>  
                <NumberOfUnit>8.00</NumberOfUnit>  
                <NumberOfUnit>8.00</NumberOfUnit>  
                <NumberOfUnit>8.00</NumberOfUnit>  
                <NumberOfUnit>8.00</NumberOfUnit>  
                <NumberOfUnit>8.00</NumberOfUnit>  
                <NumberOfUnit>0.00</NumberOfUnit>  
                <NumberOfUnit>0.00</NumberOfUnit>  
            </NumberOfUnits>  
        </TimesheetLine>  
    </TimesheetLines>  
  </Timesheet>  
</Timesheets>