createEmployee
Creates a payroll employee
/Employees
Usage and SDK Samples
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );
$apiInstance = new XeroAPI\XeroPHP\Api\PayrollAuApi(
new GuzzleHttp\Client(),
$config
);
$xeroTenantId = "xeroTenantId_example";
$dateOfBirth = new DateTime('2000-10-28');
$homeAddress = new XeroAPI\XeroPHP\Models\PayrollAu\HomeAddress;
$homeAddress->setAddressLine1('123 Test st');
$homeAddress->setRegion('VIC');
$homeAddress->setPostalCode(3000);
$homeAddress->setCity('Melbourne');
$employee = new XeroAPI\XeroPHP\Models\PayrollAu\Employee;
$employee->setFirstName('Adam');
$employee->setLastName('Adamson');
$employee->setDateOfBirth($dateOfBirth);
$employee->setHomeAddress($homeAddress);
try {
$result = $apiInstance->createEmployee($xeroTenantId, $employee);
} catch (Exception $e) {
echo 'Exception when calling PayrollAuApi->createEmployee: ', $e->getMessage(), PHP_EOL;
}
?>
Scopes
payroll.employees | Grant read-write access to payroll employees |
Parameters
Name | Description |
---|---|
Xero-Tenant-Id* |
String
Xero identifier for Tenant
Required
|
Name | Description |
---|---|
employee * |
array[Employee]
Required
|