Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Xero Get Payroll EmployeesDownload Xero employees information For more information, see https://developer.xero.com/documentation/payroll-api/employees
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Token Handle hoJsonToken Boolean iSuccess Variant vResp Handle hoResp Handle hoJson String sEmployeeID String sFirstName String sLastName String sV_Email String sDateOfBirth String sGender String sPhone String sMobile String sStartDate String sOrdinaryEarningsRateID String sPayrollCalendarID String sUpdatedDateUTC String sId String sStatus String sProviderName String sDateTimeUTC Integer i Integer iCount_i String sTemp1 Integer iTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken If (Not(IsComObjectCreated(hoJsonToken))) Begin Send CreateComObject of hoJsonToken End Get ComLoadFile Of hoJsonToken "qa_data/tokens/xero-access-token.json" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoJsonToken To sTemp1 Showln sTemp1 Procedure_Return End Get ComStringOf Of hoJsonToken "access_token" To sTemp1 Set ComAuthToken Of hoHttp To sTemp1 // Replace the value here with an actual tenant ID obtained from this example: // Get Xero Tenant IDs Send ComSetRequestHeader To hoHttp "Xero-tenant-id" "83299b9e-5747-4a14-a18a-a6c94f824eb7" Set ComAccept Of hoHttp To "application/json" Get ComQuickRequest Of hoHttp "GET" "https://api.xero.com/payroll.xro/1.0/Employees" To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComStatusCode Of hoResp To iTemp1 Showln "Response Status Code: " iTemp1 Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Get ComBodyStr Of hoResp To sTemp1 Get ComLoad Of hoJson sTemp1 To iSuccess Set ComEmitCompact Of hoJson To False Get ComEmit Of hoJson To sTemp1 Showln sTemp1 Get ComStatusCode Of hoResp To iTemp1 If (iTemp1 <> 200) Begin Showln "Failed." Send Destroy of hoResp Procedure_Return End Send Destroy of hoResp // Sample response // (See the parsing code below..) // // Use the this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON // { // "Id": "796cae61-a7c3-425b-a621-372ab1f29460", // "Status": "OK", // "ProviderName": "Chilkat2222", // "DateTimeUTC": "\/Date(1587075322768)\/", // "Employees": [ // { // "EmployeeID": "f12e3b0b-4b4c-4523-b8c0-f481a07bfd13", // "FirstName": "James", // "LastName": "Lebron", // "Status": "ACTIVE", // "Email": "JL@madeup.email.com", // "DateOfBirth": "\/Date(492739200000+0000)\/", // "Gender": "M", // "Phone": "0400-000-123", // "Mobile": " 408-230-9732", // "StartDate": "\/Date(1548806400000+0000)\/", // "OrdinaryEarningsRateID": "e648f7bf-af43-41bc-98ea-e7ca94c3e3b1", // "PayrollCalendarID": "2cf6326a-d48b-41bf-bf36-7a73b42dd71b", // "UpdatedDateUTC": "\/Date(1587075120000+0000)\/" // }, // { // "EmployeeID": "d9f5979f-1de8-4040-aa1d-f1fdd327f893", // "FirstName": "Odette", // "LastName": "Garrison", // "Status": "ACTIVE", // "Email": "ogg@madeup.email.com", // "DateOfBirth": "\/Date(390528000000+0000)\/", // "Gender": "F", // "Phone": "9000 1234", // "StartDate": "\/Date(1554422400000+0000)\/", // "OrdinaryEarningsRateID": "e648f7bf-af43-41bc-98ea-e7ca94c3e3b1", // "PayrollCalendarID": "ec0f2f68-f4d1-4490-af70-78e5d7f5dcbd", // "UpdatedDateUTC": "\/Date(1587075120000+0000)\/" // }, // { // "EmployeeID": "22879fb4-d13b-46ed-9c07-e43aba25b576", // "FirstName": "Oliver", // "LastName": "Gray", // "Status": "ACTIVE", // "Email": "og@madeup.email.com", // "DateOfBirth": "\/Date(94176000000+0000)\/", // "Gender": "M", // "Phone": "0401 123 456", // "StartDate": "\/Date(1562112000000+0000)\/", // "OrdinaryEarningsRateID": "e648f7bf-af43-41bc-98ea-e7ca94c3e3b1", // "PayrollCalendarID": "2cf6326a-d48b-41bf-bf36-7a73b42dd71b", // "UpdatedDateUTC": "\/Date(1587075120000+0000)\/" // }, // { // "EmployeeID": "c4d82c18-b1a9-4b6c-982c-14b45b95c10a", // "FirstName": "Sally ", // "LastName": "Martin", // "Status": "ACTIVE", // "Email": "sm@madeup3993.com", // "DateOfBirth": "\/Date(659577600000+0000)\/", // "Gender": "F", // "Phone": "0400 123 456", // "StartDate": "\/Date(1577750400000+0000)\/", // "OrdinaryEarningsRateID": "e648f7bf-af43-41bc-98ea-e7ca94c3e3b1", // "PayrollCalendarID": "2cf6326a-d48b-41bf-bf36-7a73b42dd71b", // "UpdatedDateUTC": "\/Date(1587075120000+0000)\/" // }, // { // "EmployeeID": "e1a5eed0-721e-482d-b1f1-0b73506f26fb", // "FirstName": "Sonia", // "LastName": "Michaels", // "Status": "ACTIVE", // "Email": "som@madeup3993.com", // "DateOfBirth": "\/Date(727660800000+0000)\/", // "Gender": "F", // "Phone": "02 2345 6789", // "Mobile": " ", // "UpdatedDateUTC": "\/Date(1587075120000+0000)\/" // }, // { // "EmployeeID": "882587ac-1cfe-4f55-9b37-932b0705cd04", // "FirstName": "Tracy", // "LastName": "Green", // "Status": "ACTIVE", // "Email": "tg@madeup.email.com", // "DateOfBirth": "\/Date(712886400000+0000)\/", // "Gender": "F", // "Phone": "0402 123 456", // "StartDate": "\/Date(1556755200000+0000)\/", // "OrdinaryEarningsRateID": "e648f7bf-af43-41bc-98ea-e7ca94c3e3b1", // "PayrollCalendarID": "ec0f2f68-f4d1-4490-af70-78e5d7f5dcbd", // "UpdatedDateUTC": "\/Date(1587075120000+0000)\/" // } // ] // } Get ComStringOf Of hoJson "Id" To sId Get ComStringOf Of hoJson "Status" To sStatus Get ComStringOf Of hoJson "ProviderName" To sProviderName Get ComStringOf Of hoJson "DateTimeUTC" To sDateTimeUTC Move 0 To i Get ComSizeOfArray Of hoJson "Employees" To iCount_i While (i < iCount_i) Set ComI Of hoJson To i Get ComStringOf Of hoJson "Employees[i].EmployeeID" To sEmployeeID Get ComStringOf Of hoJson "Employees[i].FirstName" To sFirstName Get ComStringOf Of hoJson "Employees[i].LastName" To sLastName Get ComStringOf Of hoJson "Employees[i].Status" To sStatus Get ComStringOf Of hoJson "Employees[i].Email" To sV_Email Get ComStringOf Of hoJson "Employees[i].DateOfBirth" To sDateOfBirth Get ComStringOf Of hoJson "Employees[i].Gender" To sGender Get ComStringOf Of hoJson "Employees[i].Phone" To sPhone Get ComStringOf Of hoJson "Employees[i].Mobile" To sMobile Get ComStringOf Of hoJson "Employees[i].StartDate" To sStartDate Get ComStringOf Of hoJson "Employees[i].OrdinaryEarningsRateID" To sOrdinaryEarningsRateID Get ComStringOf Of hoJson "Employees[i].PayrollCalendarID" To sPayrollCalendarID Get ComStringOf Of hoJson "Employees[i].UpdatedDateUTC" To sUpdatedDateUTC Move (i + 1) To i Loop End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.