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
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) Faire - Get All Products

See more Faire Examples

Retrieves a list of products, ordered ascending by updated_at. By default, it only returns non-deleted products.

For more information, see https://faire.github.io/external-api-docs/#get-all-products

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 vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sId
    String sBrand_id
    String sShort_description
    String sDescription
    Integer iWholesale_price_cents
    Integer iRetail_price_cents
    String sSale_state
    Boolean iActive
    Boolean iDeleted
    String sName
    Integer iUnit_multiplier
    String sTaxonomy_typeId
    String sTaxonomy_typeName
    String sCreated_at
    String sUpdated_at
    Integer j
    Integer iCount_j
    Integer iPage
    Integer iLimit
    Integer i
    Integer iCount_i
    String sTemp1
    Boolean bTemp1

    // 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 -X GET -H "X-FAIRE-ACCESS-TOKEN: <access_token>" -d "limit=50" -d "page=1" https://www.faire.com/api/v1/products

    // 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
    Get ComUpdateInt Of hoQueryParams "limit" 50 To iSuccess
    Get ComUpdateInt Of hoQueryParams "page" 1 To iSuccess

    Send ComSetRequestHeader To hoHttp "X-FAIRE-ACCESS-TOKEN" "<access_token>"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://www.faire.com/api/v1/products" 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 Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    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 ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

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

    // {
    //   "page": 1,
    //   "limit": 50,
    //   "products": [
    //     {
    //       "id": "p_123",
    //       "brand_id": "b_abc",
    //       "short_description": "Our candles smell fantastic. Want to know how good? Read our description!",
    //       "description": "Glad you decided to read our description! We have significantly more characters to describe to you just how good our candles smell.",
    //       "wholesale_price_cents": 500,
    //       "retail_price_cents": 1000,
    //       "sale_state": "FOR_SALE",
    //       "active": true,
    //       "deleted": false,
    //       "name": "Faire's fantastic candle",
    //       "unit_multiplier": 8,
    //       "taxonomy_type": {
    //         "id": "tt_23nl3bzl00",
    //         "name": "Votive Candle"
    //       },
    //       "options": [
    //       ],
    //       "created_at": "20190314T000915.000Z",
    //       "updated_at": "20190315T000915.000Z"
    //     }
    //   ]
    // }

    // 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 "page" To iPage
    Get ComIntOf Of hoJResp "limit" To iLimit
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "products" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "products[i].id" To sId
        Get ComStringOf Of hoJResp "products[i].brand_id" To sBrand_id
        Get ComStringOf Of hoJResp "products[i].short_description" To sShort_description
        Get ComStringOf Of hoJResp "products[i].description" To sDescription
        Get ComIntOf Of hoJResp "products[i].wholesale_price_cents" To iWholesale_price_cents
        Get ComIntOf Of hoJResp "products[i].retail_price_cents" To iRetail_price_cents
        Get ComStringOf Of hoJResp "products[i].sale_state" To sSale_state
        Get ComBoolOf Of hoJResp "products[i].active" To iActive
        Get ComBoolOf Of hoJResp "products[i].deleted" To iDeleted
        Get ComStringOf Of hoJResp "products[i].name" To sName
        Get ComIntOf Of hoJResp "products[i].unit_multiplier" To iUnit_multiplier
        Get ComStringOf Of hoJResp "products[i].taxonomy_type.id" To sTaxonomy_typeId
        Get ComStringOf Of hoJResp "products[i].taxonomy_type.name" To sTaxonomy_typeName
        Get ComStringOf Of hoJResp "products[i].created_at" To sCreated_at
        Get ComStringOf Of hoJResp "products[i].updated_at" To sUpdated_at
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "products[i].options" 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.