Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) Xero Get Individual Employee Details (Payroll API Australia)

Demonstrates how to get the detailed data for a particular employee.

Note: This example requires Chilkat v9.5.0.64 or greater.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoRest
    Boolean iSuccess
    Handle hoSbPath
    Variant vSbXml
    Handle hoSbXml
    Boolean iBAutoTrim
    Handle hoXml
    Integer iRecordCount
    Integer i
    String sTemp1
    Integer iTemp1

    // Note: Requires Chilkat v9.5.0.64 or greater.

    // This requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End

    // Before sending REST API calls, the REST object needs to be
    // initialized for OAuth1.
    // See Xero 2-Legged OAuth1 Setup for sample code.

    // Assuming the REST object's OAuth1 authenticator is setup, and the initial
    // connection was made, we may now send REST HTTP requests..

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbPath
    If (Not(IsComObjectCreated(hoSbPath))) Begin
        Send CreateComObject of hoSbPath
    End
    Get ComAppend Of hoSbPath "/payroll.xro/1.0/Employees/" To iSuccess
    // To get the detailed information for an individual employee,
    // add the EmployeeID to the path.
    Get ComAppend Of hoSbPath "056a9821-55b8-4c91-b5ce-a6ce2ab508ab" To iSuccess

    // Get the data for the indicated employee.
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbXml
    If (Not(IsComObjectCreated(hoSbXml))) Begin
        Send CreateComObject of hoSbXml
    End
    Get ComGetAsString Of hoSbPath To sTemp1
    Get pvComObject of hoSbXml to vSbXml
    Get ComFullRequestNoBodySb Of hoRest "GET" sTemp1 vSbXml To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // A 200 response is expected for actual success.
    Get ComResponseStatusCode Of hoRest To iTemp1
    If (iTemp1 <> 200) Begin
        Get ComGetAsString Of hoSbXml To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Iterate over the employees and get some information..

    Move False To iBAutoTrim
    Get Create (RefClass(cComChilkatXml)) To hoXml
    If (Not(IsComObjectCreated(hoXml))) Begin
        Send CreateComObject of hoXml
    End
    Get pvComObject of hoSbXml to vSbXml
    Get ComLoadSb Of hoXml vSbXml iBAutoTrim To iSuccess
    Get ComSaveXml Of hoXml "qa_cache/xero_employee_lebron.xml" To iSuccess

    // Use GetChild2 to navigate to the BankAccounts node.
    Get ComFindChild2 Of hoXml "Employees|Employee|BankAccounts" To iSuccess
    If (iSuccess = False) Begin
        Showln "BankAccounts node not found."
        Procedure_Return
    End

    // Demonstrate how to iterate over each of the employee's Bank Accounts to get information
    // from each.  (This same technique can be used for other parts of the XML.)
    Get ComNumChildren Of hoXml To iRecordCount
    Showln "Number of Bank Accounts = " iRecordCount

    Move 0 To i
    While (i < iRecordCount)
        Set ComI Of hoXml To i
        Get ComGetChildContent Of hoXml "BankAccount|AccountName" To sTemp1
        Showln "AccountName: " sTemp1
        Get ComGetChildContent Of hoXml "BankAccount|StatementText" To sTemp1
        Showln "StatementText: " sTemp1
        Get ComGetChildContent Of hoXml "BankAccount|AccountNumber" To sTemp1
        Showln "AccountNumber: " sTemp1
        Get ComGetChildContent Of hoXml "BankAccount|Amount" To sTemp1
        Showln "Amount: " sTemp1
        Showln "----"
        Move i + 1 To i
    Loop

    // Return back to the root.
    Send ComGetRoot2 To hoXml

    // The output looks like this:

    // 	Number of Bank Accounts = 2
    // 	AccountName: James Lebron Savings
    // 	StatementText: Salary
    // 	AccountNumber: 345678
    // 	Amount: 200.00
    // 	----
    // 	AccountName: James Lebron Savings
    // 	StatementText: Salary
    // 	AccountNumber: 345678
    // 	Amount: 200.00
    // 	----

    // The employee XML looks like this:

    // 	<?xml version="1.0" encoding="utf-8" ?>
    // 	<Response xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    // 	    <Id>6131dfc6-d11c-4fe0-aa1c-f7356c54754c</Id>
    // 	    <Status>OK</Status>
    // 	    <ProviderName>ChilkatAU</ProviderName>
    // 	    <DateTimeUTC>2016-11-11T20:53:38.752419Z</DateTimeUTC>
    // 	    <Employees>
    // 	        <Employee>
    // 	            <EmployeeID>056a9821-55b8-4c91-b5ce-a6ce2ab508ab</EmployeeID>
    // 	            <FirstName>James</FirstName>
    // 	            <LastName>Lebron</LastName>
    // 	            <Status>ACTIVE</Status>
    // 	            <Email>JL@madeup.email.com</Email>
    // 	            <DateOfBirth>1982-03-15T00:00:00</DateOfBirth>
    // 	            <Gender>M</Gender>
    // 	            <HomeAddress>
    // 	                <AddressLine1>123 Main St</AddressLine1>
    // 	                <City>St. Kilda</City>
    // 	                <Region>VIC</Region>
    // 	                <PostalCode>3182</PostalCode>
    // 	                <Country>AUSTRALIA</Country>
    // 	            </HomeAddress>
    // 	            <Phone>0400-000-123</Phone>
    // 	            <Mobile> 408-230-9732</Mobile>
    // 	            <StartDate>2015-09-01T00:00:00</StartDate>
    // 	            <OrdinaryEarningsRateID>2c4fbb29-aa68-4a8d-bc05-3f6366f75227</OrdinaryEarningsRateID>
    // 	            <PayrollCalendarID>4c08f63d-53af-4521-a8be-1d77fc0faf45</PayrollCalendarID>
    // 	            <UpdatedDateUTC>2016-11-11T20:29:03</UpdatedDateUTC>
    // 	            <IsAuthorisedToApproveLeave>false</IsAuthorisedToApproveLeave>
    // 	            <TaxDeclaration>
    // 	                <TaxFileNumber>999999811</TaxFileNumber>
    // 	                <EmploymentBasis>FULLTIME</EmploymentBasis>
    // 	                <AustralianResidentForTaxPurposes>true</AustralianResidentForTaxPurposes>
    // 	                <TaxFreeThresholdClaimed>true</TaxFreeThresholdClaimed>
    // 	                <HasHELPDebt>true</HasHELPDebt>
    // 	                <HasSFSSDebt>false</HasSFSSDebt>
    // 	                <EligibleToReceiveLeaveLoading>false</EligibleToReceiveLeaveLoading>
    // 	                <UpdatedDateUTC>2016-11-11T20:29:03</UpdatedDateUTC>
    // 	                <HasStudentStartupLoan>false</HasStudentStartupLoan>
    // 	            </TaxDeclaration>
    // 	            <BankAccounts>
    // 	                <BankAccount>
    // 	                    <StatementText>Salary</StatementText>
    // 	                    <AccountName>James Lebron Savings</AccountName>
    // 	                    <BSB>122344</BSB>
    // 	                    <AccountNumber>345678</AccountNumber>
    // 	                    <Remainder>false</Remainder>
    // 	                    <Amount>200.00</Amount>
    // 	                </BankAccount>
    // 	                <BankAccount>
    // 	                    <StatementText>Salary</StatementText>
    // 	                    <AccountName>James Lebron</AccountName>
    // 	                    <BSB>123443</BSB>
    // 	                    <AccountNumber>2345678</AccountNumber>
    // 	                    <Remainder>true</Remainder>
    // 	                </BankAccount>
    // 	            </BankAccounts>
    // 	            <OpeningBalances>
    // 	                <OpeningBalanceDate>2016-02-01T00:00:00</OpeningBalanceDate>
    // 	                <EarningsLines>
    // 	                    <EarningsLine>
    // 	                        <EarningsRateID>2c4fbb29-aa68-4a8d-bc05-3f6366f75227</EarningsRateID>
    // 	                        <Amount>13333.33</Amount>
    // 	                    </EarningsLine>
    // 	                </EarningsLines>
    // 	                <DeductionLines>
    // 	                    <DeductionLine>
    // 	                        <DeductionTypeID>2fd4c1e2-5bbb-43e4-a396-4c146f2f9b77</DeductionTypeID>
    // 	                        <Amount>40.00</Amount>
    // 	                    </DeductionLine>
    // 	                </DeductionLines>
    // 	                <Tax>4000.00</Tax>
    // 	                <SuperLines>
    // 	                    <SuperLine>
    // 	                        <SuperMembershipID>9e9cc70d-1d6c-4ce5-a402-2c4fe80c02b0</SuperMembershipID>
    // 	                        <ContributionType>SGC</ContributionType>
    // 	                        <Amount>3999.99</Amount>
    // 	                    </SuperLine>
    // 	                </SuperLines>
    // 	                <ReimbursementLines />
    // 	                <LeaveLines>
    // 	                    <LeaveLine>
    // 	                        <LeaveTypeID>8aa43544-f7f2-4b7a-9ddf-0a9c831c4679</LeaveTypeID>
    // 	                        <NumberOfUnits>100.0000</NumberOfUnits>
    // 	                    </LeaveLine>
    // 	                    <LeaveLine>
    // 	                        <LeaveTypeID>8874e0c0-d1d8-4635-a359-c09f6cf1c747</LeaveTypeID>
    // 	                        <NumberOfUnits>40.0000</NumberOfUnits>
    // 	                    </LeaveLine>
    // 	                </LeaveLines>
    // 	            </OpeningBalances>
    // 	            <PayTemplate>
    // 	                <EarningsLines>
    // 	                    <EarningsLine>
    // 	                        <EarningsRateID>2c4fbb29-aa68-4a8d-bc05-3f6366f75227</EarningsRateID>
    // 	                        <CalculationType>ANNUALSALARY</CalculationType>
    // 	                        <AnnualSalary>40000.00</AnnualSalary>
    // 	                        <NumberOfUnitsPerWeek>38.0000</NumberOfUnitsPerWeek>
    // 	                    </EarningsLine>
    // 	                </EarningsLines>
    // 	                <DeductionLines>
    // 	                    <DeductionLine>
    // 	                        <DeductionTypeID>2fd4c1e2-5bbb-43e4-a396-4c146f2f9b77</DeductionTypeID>
    // 	                        <CalculationType>FIXEDAMOUNT</CalculationType>
    // 	                        <Amount>10.00</Amount>
    // 	                    </DeductionLine>
    // 	                </DeductionLines>
    // 	                <SuperLines>
    // 	                    <SuperLine>
    // 	                        <SuperMembershipID>9e9cc70d-1d6c-4ce5-a402-2c4fe80c02b0</SuperMembershipID>
    // 	                        <ContributionType>SGC</ContributionType>
    // 	                        <CalculationType>PERCENTAGEOFEARNINGS</CalculationType>
    // 	                        <MinimumMonthlyEarnings>450.00</MinimumMonthlyEarnings>
    // 	                        <ExpenseAccountCode>478</ExpenseAccountCode>
    // 	                        <LiabilityAccountCode>826</LiabilityAccountCode>
    // 	                        <Percentage>9.0000</Percentage>
    // 	                    </SuperLine>
    // 	                    <SuperLine>
    // 	                        <SuperMembershipID>9e9cc70d-1d6c-4ce5-a402-2c4fe80c02b0</SuperMembershipID>
    // 	                        <ContributionType>SALARYSACRIFICE</ContributionType>
    // 	                        <CalculationType>FIXEDAMOUNT</CalculationType>
    // 	                        <ExpenseAccountCode>478</ExpenseAccountCode>
    // 	                        <LiabilityAccountCode>826</LiabilityAccountCode>
    // 	                        <Amount>50.0000</Amount>
    // 	                    </SuperLine>
    // 	                </SuperLines>
    // 	                <ReimbursementLines />
    // 	                <LeaveLines>
    // 	                    <LeaveLine>
    // 	                        <LeaveTypeID>8aa43544-f7f2-4b7a-9ddf-0a9c831c4679</LeaveTypeID>
    // 	                        <CalculationType>FIXEDAMOUNTEACHPERIOD</CalculationType>
    // 	                        <AnnualNumberOfUnits>152.0000</AnnualNumberOfUnits>
    // 	                    </LeaveLine>
    // 	                    <LeaveLine>
    // 	                        <LeaveTypeID>8874e0c0-d1d8-4635-a359-c09f6cf1c747</LeaveTypeID>
    // 	                        <CalculationType>FIXEDAMOUNTEACHPERIOD</CalculationType>
    // 	                        <AnnualNumberOfUnits>76.0000</AnnualNumberOfUnits>
    // 	                    </LeaveLine>
    // 	                </LeaveLines>
    // 	            </PayTemplate>
    // 	            <SuperMemberships>
    // 	                <SuperMembership>
    // 	                    <SuperMembershipID>9e9cc70d-1d6c-4ce5-a402-2c4fe80c02b0</SuperMembershipID>
    // 	                    <SuperFundID>2bab4eeb-6f3c-4c66-a1f0-52fcb81f412a</SuperFundID>
    // 	                    <EmployeeNumber>1234</EmployeeNumber>
    // 	                </SuperMembership>
    // 	            </SuperMemberships>
    // 	            <LeaveBalances>
    // 	                <LeaveBalance>
    // 	                    <LeaveName>Annual Leave</LeaveName>
    // 	                    <LeaveTypeID>8aa43544-f7f2-4b7a-9ddf-0a9c831c4679</LeaveTypeID>
    // 	                    <NumberOfUnits>88.8602</NumberOfUnits>
    // 	                    <TypeOfUnits>Hours</TypeOfUnits>
    // 	                </LeaveBalance>
    // 	                <LeaveBalance>
    // 	                    <LeaveName>Personal/Carer's Leave</LeaveName>
    // 	                    <LeaveTypeID>8874e0c0-d1d8-4635-a359-c09f6cf1c747</LeaveTypeID>
    // 	                    <NumberOfUnits>45.8302</NumberOfUnits>
    // 	                    <TypeOfUnits>Hours</TypeOfUnits>
    // 	                </LeaveBalance>
    // 	            </LeaveBalances>
    // 	        </Employee>
    // 	    </Employees>
    // 	</Response>
    // 
    // 


End_Procedure

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.