This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Employees in Xero



Overview

The following operations allow you to work with employees. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with employees, see Sample configuration

OperationDescription

getEmployee

Retrieves a list of employees.

postEmployeesCreates or updates payroll employees.

Operation details

This section provides further details on the operations related to employees.

Retrieving employee details

The getEmployee operation retrieves details of one or more employees.

getEmployee
<xero.getEmployee>
    <employeeId>{$ctx:employeeId}</employeeId>
    <order>{$ctx:order}</order>
    <page>{$ctx:page}</page>
    <modifiedAfter>{$ctx:modifiedAfter}</modifiedAfter>
	<where>{$ctx:where}</where>
</xero.getEmployee>
Properties
  • employeeId: The ID of the employee.
  • order: The parameter by which the employees to be retrieved are sorted.
  • page: The page number of the list of employees that needs to be retrieved.
  • modifiedAfter: The timestamp after which the employee details are retrieved. If specified, only employees created or modified after this timestamp will be retrieved. 
  • where: The parameter by which the employees to be retrieved are filtered.
Sample request

Following is a sample REST/XML request that can be handled by the getEmployee operation.

Sample Request for getEmployee
<getEmployee>
	<consumerKey>IT5UHNVQLNHLYLOBSPOCYLNVSA5PHW</consumerKey>
    <consumerSecret>6PWOUC0VEDYSS2AYZMYFQXOEFIVS4R</consumerSecret>
    <accessToken>MGP9XYMGKGZKC7GUN2BUERDNTDBCB0</accessToken>
    <accessTokenSecret>YJZ7CS4WLHP73ADOU2PGGSF6LTGIQM</accessTokenSecret>
    <acceptType></acceptType>
    <apiUrl>https://api.xero.com</apiUrl>
    <employeeId>b57b566e-c24e-4004-a06f-7403b9b3c5a9</employeeId>
    <order></order>
    <page>1</page>
    <modifiedAfter></modifiedAfter>
    <where></where>
</getEmployee>
Related Xero documentation
http://developer.xero.com/documentation/payroll-api-us/employees/#GET 

Creating and updating employee details

The postEmployees operation creates or updates one or more payroll employees. 

postEmployees
<xero.postEmployees>
	<employees>{$ctx:employees}</employees>
</xero.postEmployees>
Properties
  • employees: Employee details. You can pass details of one or more employees through this property.
Sample request

Following is a sample REST/XML request that can be handled by the postEmployees operation.

Sample Request for postEmployees
<postEmployees>
   <consumerKey>KSIOWOXFPW4YLYAT4G7HKBCDPQDH5V</consumerKey>
   <consumerSecret>BBB7NYKAQSRKVTNDTHO74IFW0MJB9V</consumerSecret>
   <accessToken>IUHIQ21J7TTU5FLAAPTUOSTB6RZVDO</accessToken>
   <accessTokenSecret>SARQV3JILDXIUN2UVP8JSIS6OIMF4V</accessTokenSecret>
   <apiUrl>https://api.xero.com</apiUrl>
   <employees>
	<Employee>
	    <EmployeeID>77b924fa-a308-4b82-af41-d083e2aa3eae</EmployeeID>
	    <FirstName>Jenna</FirstName>
	    <LastName>Eyre</LastName>
	    <HomeAddress>
	      <StreetAddress>244 Jackson St</StreetAddress>
	      <City>San Francisco</City>
	      <State>CA</State>
	      <Zip>94111</Zip>
	      <Latitude>37.79690</Latitude>
	      <Longitude>-122.40033</Longitude>
	    </HomeAddress>
	  </Employee>
   </employees>
</postEmployees>
Related Xero documentation
http://developer.xero.com/documentation/payroll-api-us/employees/#POST

Sample configuration

Following is a sample proxy service that illustrates how to connect to Xero with the init operation and use the getEmployee operation. The sample request for this proxy can be found in getEmployee sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="xero_getEmployee"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="consumerKey" expression="//consumerKey/text()"/>
         <property name="accessToken" expression="//accessToken/text()"/>
         <property name="accessTokenSecret" expression="//accessTokenSecret/text()"/>
         <property name="apiUrl" expression="//apiUrl/text()"/>
         <property name="consumerSecret" expression="//consumerSecret/text()"/>
         <property name="employeeId" expression="//employeeId/text()"/>
         <property name="order" expression="//order/text()"/>
         <property name="page" expression="//page/text()"/>
         <property name="modifiedAfter" expression="//modifiedAfter/text()"/>
         <property name="where" expression="//where/text()"/>
         <property name="acceptType" expression="//acceptType/text()"/>
         <xero.init>
            <consumerKey>{$ctx:consumerKey}</consumerKey>
            <accessToken>{$ctx:accessToken}</accessToken>
            <accessTokenSecret>{$ctx:accessTokenSecret}</accessTokenSecret>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <consumerSecret>{$ctx:consumerSecret}</consumerSecret>
            <acceptType>{$ctx:acceptType}</acceptType>
         </xero.init>
         <xero.getEmployee>
            <employeeId>{$ctx:employeeId}</employeeId>
            <order>{$ctx:order}</order>
            <page>{$ctx:page}</page>
            <modifiedAfter>{$ctx:modifiedAfter}</modifiedAfter>
            <where>{$ctx:where}</where>
         </xero.getEmployee>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>