Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Web API Examples

Primary Categories

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

MedTunnel
MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Okta OAuth/OIDC
OneLogin OIDC
OneNote
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
UniPin
VoiceBase
Vonage
Walmart
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yousign
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) Square API - List Catalog

Returns a list of CatalogObjects that includes all objects of a set of desired types (for example, all CatalogItem and CatalogTax objects) in the catalog.

For more information, see https://developer.squareup.com/reference/square/catalog-api/list-catalog

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sV_type
    String sId
    String sUpdated_at
    Integer iVersion
    Boolean iIs_deleted
    Boolean iPresent_at_all_locations
    String sCategory_dataName
    String sTax_dataName
    String sTax_dataCalculation_phase
    String sTax_dataInclusion_type
    String sTax_dataPercentage
    Boolean iTax_dataEnabled
    Integer i
    Integer iCount_i
    String sTemp1

    // This example assumes 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

    // Implements the following CURL command:

    // curl https://connect.squareup.com/v2/catalog/list?types=category%2Ctax \
    //   -H 'Square-Version: 2020-07-22' \
    //   -H 'Authorization: Bearer ACCESS_TOKEN' \
    //   -H 'Content-Type: application/json'

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

    // Adds the "Authorization: Bearer ACCESS_TOKEN" header.
    Set ComAuthToken Of hoHttp To "ACCESS_TOKEN"
    Send ComSetRequestHeader To hoHttp "Square-Version" "2020-07-22"
    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"

    // This example uses the sandbox: connect.squareupsandbox.com
    // Production should use connect.squareup.com
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://connect.squareupsandbox.com/v2/catalog/list?types=item,category,tax,image" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "objects": [
    //     {
    //       "type": "CATEGORY",
    //       "id": "5ZYQZZ2IECPVJ2IJ5KQPRDC3",
    //       "updated_at": "2017-02-21T14:50:26.495Z",
    //       "version": 1487688626495,
    //       "is_deleted": false,
    //       "present_at_all_locations": true,
    //       "category_data": {
    //         "name": "Beverages"
    //       }
    //     },
    //     {
    //       "type": "TAX",
    //       "id": "L5R47DGBZOOVKCAFIXC56AEN",
    //       "updated_at": "2017-02-21T14:50:26.495Z",
    //       "version": 1487688626495,
    //       "is_deleted": false,
    //       "present_at_all_locations": true,
    //       "tax_data": {
    //         "name": "Sales Tax",
    //         "calculation_phase": "TAX_SUBTOTAL_PHASE",
    //         "inclusion_type": "ADDITIVE",
    //         "percentage": "5.0",
    //         "enabled": true
    //       }
    //     }
    //   ]
    // }

    // Sample code for parsing the JSON response...
    // Use the following online tool to generate parsing code from sample JSON:
    // Generate Parsing Code from JSON

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "objects" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "objects[i].type" To sV_type
        Get ComStringOf Of hoJResp "objects[i].id" To sId
        Get ComStringOf Of hoJResp "objects[i].updated_at" To sUpdated_at
        Get ComIntOf Of hoJResp "objects[i].version" To iVersion
        Get ComBoolOf Of hoJResp "objects[i].is_deleted" To iIs_deleted
        Get ComBoolOf Of hoJResp "objects[i].present_at_all_locations" To iPresent_at_all_locations
        Get ComStringOf Of hoJResp "objects[i].category_data.name" To sCategory_dataName
        Get ComStringOf Of hoJResp "objects[i].tax_data.name" To sTax_dataName
        Get ComStringOf Of hoJResp "objects[i].tax_data.calculation_phase" To sTax_dataCalculation_phase
        Get ComStringOf Of hoJResp "objects[i].tax_data.inclusion_type" To sTax_dataInclusion_type
        Get ComStringOf Of hoJResp "objects[i].tax_data.percentage" To sTax_dataPercentage
        Get ComBoolOf Of hoJResp "objects[i].tax_data.enabled" To iTax_dataEnabled
        Move (i + 1) To i
    Loop



End_Procedure

 

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