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

C 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
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

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
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
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

 

 

 

(C) Xero Get Payroll Employees

Download Xero employees information

For more information, see https://developer.xero.com/documentation/payroll-api/employees

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Solaris C/C++

MinGW C/C++

#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    HCkJsonObject jsonToken;
    BOOL success;
    HCkHttpResponse resp;
    HCkJsonObject json;
    const char *EmployeeID;
    const char *FirstName;
    const char *LastName;
    const char *v_Email;
    const char *DateOfBirth;
    const char *Gender;
    const char *Phone;
    const char *Mobile;
    const char *StartDate;
    const char *OrdinaryEarningsRateID;
    const char *PayrollCalendarID;
    const char *UpdatedDateUTC;
    const char *Id;
    const char *Status;
    const char *ProviderName;
    const char *DateTimeUTC;
    int i;
    int count_i;

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

    http = CkHttp_Create();

    jsonToken = CkJsonObject_Create();
    success = CkJsonObject_LoadFile(jsonToken,"qa_data/tokens/xero-access-token.json");
    if (success == FALSE) {
        printf("%s\n",CkJsonObject_lastErrorText(jsonToken));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(jsonToken);
        return;
    }

    CkHttp_putAuthToken(http,CkJsonObject_stringOf(jsonToken,"access_token"));

    // Replace the value here with an actual tenant ID obtained from this example:
    // Get Xero Tenant IDs
    CkHttp_SetRequestHeader(http,"Xero-tenant-id","83299b9e-5747-4a14-a18a-a6c94f824eb7");

    CkHttp_putAccept(http,"application/json");

    resp = CkHttp_QuickRequest(http,"GET","https://api.xero.com/payroll.xro/1.0/Employees");
    if (CkHttp_getLastMethodSuccess(http) != TRUE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(jsonToken);
        return;
    }

    printf("Response Status Code: %d\n",CkHttpResponse_getStatusCode(resp));

    json = CkJsonObject_Create();
    CkJsonObject_Load(json,CkHttpResponse_bodyStr(resp));
    CkJsonObject_putEmitCompact(json,FALSE);
    printf("%s\n",CkJsonObject_emit(json));

    if (CkHttpResponse_getStatusCode(resp) != 200) {
        printf("Failed.\n");
        CkHttpResponse_Dispose(resp);
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(jsonToken);
        CkJsonObject_Dispose(json);
        return;
    }

    CkHttpResponse_Dispose(resp);

    // 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)\/"
    //     }
    //   ]
    // }

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
    // See this example explaining how this memory should be used: const char * functions.

    Id = CkJsonObject_stringOf(json,"Id");
    Status = CkJsonObject_stringOf(json,"Status");
    ProviderName = CkJsonObject_stringOf(json,"ProviderName");
    DateTimeUTC = CkJsonObject_stringOf(json,"DateTimeUTC");
    i = 0;
    count_i = CkJsonObject_SizeOfArray(json,"Employees");
    while (i < count_i) {
        CkJsonObject_putI(json,i);
        EmployeeID = CkJsonObject_stringOf(json,"Employees[i].EmployeeID");
        FirstName = CkJsonObject_stringOf(json,"Employees[i].FirstName");
        LastName = CkJsonObject_stringOf(json,"Employees[i].LastName");
        Status = CkJsonObject_stringOf(json,"Employees[i].Status");
        v_Email = CkJsonObject_stringOf(json,"Employees[i].Email");
        DateOfBirth = CkJsonObject_stringOf(json,"Employees[i].DateOfBirth");
        Gender = CkJsonObject_stringOf(json,"Employees[i].Gender");
        Phone = CkJsonObject_stringOf(json,"Employees[i].Phone");
        Mobile = CkJsonObject_stringOf(json,"Employees[i].Mobile");
        StartDate = CkJsonObject_stringOf(json,"Employees[i].StartDate");
        OrdinaryEarningsRateID = CkJsonObject_stringOf(json,"Employees[i].OrdinaryEarningsRateID");
        PayrollCalendarID = CkJsonObject_stringOf(json,"Employees[i].PayrollCalendarID");
        UpdatedDateUTC = CkJsonObject_stringOf(json,"Employees[i].UpdatedDateUTC");
        i = i + 1;
    }



    CkHttp_Dispose(http);
    CkJsonObject_Dispose(jsonToken);
    CkJsonObject_Dispose(json);

    }

 

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