Xero API LeaveTypeID

Xero API LeaveTypeID

我正在尝试在 PHP 中集成网络应用程序以集成 Xero。我的 objective 是从应用程序向 Xero 提交请假单。

我正在使用 https://github.com/XeroAPI/XeroOAuth-PHP and did manage to get the employee lists. But the example request shows I need to pass the LeaveTypeID along with the EmployeeID. Where can I get the LeaveTypeIDs ie. What is the Leave type ID for Annual Leave or Sick leave. Here is the Sample xml Request I found in the example in http://developer.xero.com/documentation/payroll-api/leaveapplications/

<LeaveApplications>
    <LeaveApplication>
        <EmployeeID>5abad362-28aa-4c2c-a9cb-0899f7262d62</EmployeeID>
        <LeaveTypeID>dc182d9a-a270-4f4e-acd7-af702d5a4382</LeaveTypeID>
        <Title>My Test Leave</Title>
        <StartDate>2013-04-11</StartDate>
        <EndDate>2013-04-11</EndDate>
    </LeaveApplication>
</LeaveApplications>

我搜索了 Internet、Xero 文档和社区门户,但什么都没有>非常感谢任何帮助。


更新:

@ronanq - 我试过了,使用下面的代码从模拟账户中获取 LeaveTypes

$response = $XeroOAuth->request('GET', $XeroOAuth->url('PayItems', 'payroll'));
pr($response); exit;

得到以下响应:

code => 401
response => You do not have permission to access this resource.

其他端点工作正常。


解法: 感谢@ronanq。 "payroll.payitems" 需要添加为授权范围。这将提供从 xero

获取 LeaveTypes 的权限

您可以从 PayItems endpoint.

检索休假类型及其关联的 LeaveTypeID