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
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

 

 

 

(DataFlex) Shippo List All Orders

Demonstrates how to list all orders created by sending a GET request to the orders endpoint.

For more information, see https://goshippo.com/docs/orders/

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    Integer iIntVal
    Integer j
    Integer iCount_j
    String sObject_id
    String sTitle
    String sVariant_title
    String sSku
    Integer iQuantity
    String sTotal_price
    String sCurrency
    String sWeight
    String sWeight_unit
    String sManufacture_country
    String sMax_ship_time
    String sMax_delivery_time
    String sDescription
    Integer iCount
    String sNext
    String sPrevious
    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://api.goshippo.com/orders/ \
    //     -H "Authorization: ShippoToken <API_Token>"

    Send ComSetRequestHeader To hoHttp "Authorization" "ShippoToken <API_Token>"

    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://api.goshippo.com/orders/" 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)

    // {
    //   "count": 1382,
    //   "next": "https://api.goshippo.com/orders/?page=2",
    //   "previous": null,
    //   "results": [
    //     {
    //       "object_id": "4f2bc588e4e5446cb3f9fdb7cd5e190b",
    //       "object_owner": "shippotle@goshippo.com",
    //       "order_number": "#1068",
    //       "order_status": "PAID",
    //       "placed_at": "2016-09-23T01:28:12Z",
    //       "to_address": {
    //         "object_created": "2016-09-23T01:38:56Z",
    //         "object_updated": "2016-09-23T01:38:56Z",
    //         "object_id": "d799c2679e644279b59fe661ac8fa488",
    //         "object_owner": "shippotle@goshippo.com",
    //         "is_complete": true,
    //         "validation_results": {},
    //         "name": "Mr Hippo",
    //         "company": "Shippo",
    //         "street1": "215 Clayton St.",
    //         "street2": "",
    //         "city": "San Francisco",
    //         "state": "CA",
    //         "zip": "94117",
    //         "country": "US",
    //         "phone": "15553419393",
    //         "email": "shippotle@goshippo.com",
    //         "is_residential": null,
    //         "metadata": ""
    //       },
    //       "from_address": null,
    //       "line_items": [
    //         {
    //           "object_id": "abf7d5675d744b6ea9fdb6f796b28f28",
    //           "title": "Hippo Magazines",
    //           "variant_title": "",
    //           "sku": "HM-123",
    //           "quantity": 1,
    //           "total_price": "12.10",
    //           "currency": "USD",
    //           "weight": "0.40",
    //           "weight_unit": "lb",
    //           "manufacture_country": null,
    //           "max_ship_time": null,
    //           "max_delivery_time": null,
    //           "description": null
    //         }
    //       ],
    //       "shipping_cost": "12.83",
    //       "shipping_cost_currency": "USD",
    //       "shipping_method": "USPS First Class Package",
    //       "shop_app": "Shippo",
    //       "subtotal_price": "12.10",
    //       "total_price": "24.93",
    //       "total_tax": "0.00",
    //       "currency": "USD",
    //       "transactions": [
    //       ],
    //       "weight": "0.40",
    //       "weight_unit": "lb",
    //       "notes": null
    //     },
    //     ...
    //   ]
    // }

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

    Get ComIntOf Of hoJResp "count" To iCount
    Get ComStringOf Of hoJResp "next" To sNext
    Get ComStringOf Of hoJResp "previous" To sPrevious
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "results" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComIntOf Of hoJResp "results[i]" To iIntVal
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "results[i].line_items" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "results[i].line_items[j].object_id" To sObject_id
            Get ComStringOf Of hoJResp "results[i].line_items[j].title" To sTitle
            Get ComStringOf Of hoJResp "results[i].line_items[j].variant_title" To sVariant_title
            Get ComStringOf Of hoJResp "results[i].line_items[j].sku" To sSku
            Get ComIntOf Of hoJResp "results[i].line_items[j].quantity" To iQuantity
            Get ComStringOf Of hoJResp "results[i].line_items[j].total_price" To sTotal_price
            Get ComStringOf Of hoJResp "results[i].line_items[j].currency" To sCurrency
            Get ComStringOf Of hoJResp "results[i].line_items[j].weight" To sWeight
            Get ComStringOf Of hoJResp "results[i].line_items[j].weight_unit" To sWeight_unit
            Get ComStringOf Of hoJResp "results[i].line_items[j].manufacture_country" To sManufacture_country
            Get ComStringOf Of hoJResp "results[i].line_items[j].max_ship_time" To sMax_ship_time
            Get ComStringOf Of hoJResp "results[i].line_items[j].max_delivery_time" To sMax_delivery_time
            Get ComStringOf Of hoJResp "results[i].line_items[j].description" To sDescription
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "results[i].transactions" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

 

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