Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples
Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
X
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) Datev - Get a List of Clients

See more Datev Examples
Demonstrates how to get a list of clients in the accounting:clients Datev API.

Note: This example requires Chilkat v10.1.3 or greater.

For more information, see https://developer.datev.de/en/product-detail/accounting-clients/2.0/reference/reference-api-overview/accountingclients/clients-get

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    Handle hoJarr
    Variant vJson
    Handle hoJson
    Integer iClient_number
    Integer iConsultant_number
    String sId
    String sName
    Integer j
    Integer iCount_j
    Integer k
    Integer iCount_k
    String sStrVal
    Integer i
    Integer iCount_i
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Implements the following CURL command:

    // curl --request GET \
    //   --url "https://accounting-clients.api.datev.de/platform/v2/clients?filter=REPLACE_THIS_VALUE&skip=REPLACE_THIS_VALUE&top=REPLACE_THIS_VALUE" \
    //   --header "Authorization: Bearer REPLACE_BEARER_TOKEN" \
    //   --header "X-Datev-Client-ID: clientId" \
    //   --header "accept: application/json;charset=utf-8"

    // Use the following online tool to generate HTTP code from a CURL command
    // Convert a cURL Command to HTTP Source Code

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    // ignore = queryParams.UpdateString("filter","REPLACE_THIS_VALUE");
    // ignore = queryParams.UpdateString("skip","REPLACE_THIS_VALUE");
    // ignore = queryParams.UpdateString("top","REPLACE_THIS_VALUE");

    // Adds the "Authorization: Bearer REPLACE_BEARER_TOKEN" header.
    Set ComAuthToken Of hoHttp To "REPLACE_BEARER_TOKEN"
    Send ComSetRequestHeader To hoHttp "accept" "application/json;charset=utf-8"
    Send ComSetRequestHeader To hoHttp "X-Datev-Client-ID" "DATEV_CLIENT_ID"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://accounting-clients.api.datev.de/platform-sandbox/v2/clients" vQueryParams 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 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln iTemp1
    Get ComBodyStr Of hoResp To sTemp1
    Showln sTemp1

    Get Create (RefClass(cComChilkatJsonArray)) To hoJarr
    If (Not(IsComObjectCreated(hoJarr))) Begin
        Send CreateComObject of hoJarr
    End

    // Insert code here to load the above JSON array into the jarr object.
    Get ComBodyStr Of hoResp To sTemp1
    Get ComLoad Of hoJarr sTemp1 To iSuccess
    Send Destroy of hoResp

    Move 0 To i
    Get ComSize Of hoJarr To iCount_i
    While (i < iCount_i)
        Get ComObjectAt Of hoJarr i To vJson
        If (IsComObject(vJson)) Begin
            Get Create (RefClass(cComChilkatJsonObject)) To hoJson
            Set pvComObject Of hoJson To vJson
        End
        Get ComIntOf Of hoJson "client_number" To iClient_number
        Get ComIntOf Of hoJson "consultant_number" To iConsultant_number
        Get ComStringOf Of hoJson "id" To sId
        Get ComStringOf Of hoJson "name" To sName
        Move 0 To j
        Get ComSizeOfArray Of hoJson "services" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "services[j].name" To sName
            Move 0 To k
            Get ComSizeOfArray Of hoJson "services[j].scopes" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJson To k
                Get ComStringOf Of hoJson "services[j].scopes[k]" To sStrVal
                Move (k + 1) To k
            Loop

            Move (j + 1) To j
        Loop

        Send Destroy of hoJson
        Move (i + 1) To i
    Loop



End_Procedure

 

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