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

 

 

 

(DataFlex) WiX - Get all Products in a Store

Gets the first page of products in a store.

For more information, see https://dev.wix.com/api/rest/wix-stores/catalog/filter-and-sort

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vJson
    Handle hoJson
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sId
    String sName
    String sSlug
    Boolean iVisible
    String sProductType
    String sDescription
    Boolean iStockTrackInventory
    Integer iStockQuantity
    Boolean iStockInStock
    String sPriceCurrency
    Integer iPricePrice
    Integer iPriceDiscountedPrice
    String sPriceFormattedPrice
    String sPriceFormattedDiscountedPrice
    String sPriceDataCurrency
    Integer iPriceDataPrice
    Integer iPriceDataDiscountedPrice
    String sPriceDataFormattedPrice
    String sPriceDataFormattedDiscountedPrice
    Boolean iManageVariants
    String sProductPageUrlBase
    String sProductPageUrlPath
    String sNumericId
    String sInventoryItemId
    String sDiscountType
    Integer iDiscountValue
    String sSku
    Integer iWeight
    Integer j
    Integer iCount_j
    String sText
    String sStrVal
    Integer iMetadataItems
    Integer iMetadataOffset
    Integer iTotalResults
    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 POST -H "Content-Type: application/json" \
    //    -d '{
    //   "includeVariants": true
    //   }' https://www.wixapis.com/stores/v1/products/query

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComUpdateBool Of hoJson "includeVariants" True To iSuccess

    Set ComAuthToken Of hoHttp To "ACCESS_TOKEN"
    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"

    Get pvComObject of hoJson to vJson
    Get ComPostJson3 Of hoHttp "https://www.wixapis.com/stores/v1/products/query" "application/json" vJson 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)

    // {
    //   "products": [
    //     {
    //       "id": "58fcbb51-ff87-08ff-d97b-646726676e4a",
    //       "name": "webhook test",
    //       "slug": "webhook-test",
    //       "visible": true,
    //       "productType": "physical",
    //       "description": "<p>fasdf<\/p>",
    //       "stock": {
    //         "trackInventory": true,
    //         "quantity": 0,
    //         "inStock": false
    //       },
    //       "price": {
    //         "currency": "ILS",
    //         "price": 234,
    //         "discountedPrice": 234,
    //         "formatted": {
    //           "price": "234.00 ₪",
    //           "discountedPrice": "234.00 ₪"
    //         }
    //       },
    //       "priceData": {
    //         "currency": "ILS",
    //         "price": 234,
    //         "discountedPrice": 234,
    //         "formatted": {
    //           "price": "234.00 ₪",
    //           "discountedPrice": "234.00 ₪"
    //         }
    //       },
    //       "additionalInfoSections": [
    //       ],
    //       "ribbons": [
    //         {
    //           "text": "ribby"
    //         }
    //       ],
    //       "media": {
    //         "items": [
    //         ]
    //       },
    //       "customTextFields": [
    //       ],
    //       "manageVariants": true,
    //       "productOptions": [
    //       ],
    //       "productPageUrl": {
    //         "base": "https://www.my-website.com/",
    //         "path": "/product-page/webhook-test"
    //       },
    //       "numericId": "1567078000586000",
    //       "inventoryItemId": "a70344ae-0078-f700-2684-9b98d99891b5",
    //       "discount": {
    //         "type": "NONE",
    //         "value": 0
    //       },
    //       "collectionIds": [
    //       ],
    //       "variants": [
    //       ]
    //     },
    //     {
    //       "id": "6507fd67-94e5-10af-73e4-d2167852d5bc",
    //       "name": "digital product",
    //       "slug": "digital-product",
    //       "visible": true,
    //       "productType": "digital",
    //       "description": "",
    //       "sku": "",
    //       "weight": 0,
    //       "stock": {
    //         "trackInventory": false,
    //         "inStock": true
    //       },
    //       "price": {
    //         "currency": "ILS",
    //         "price": 123,
    //         "discountedPrice": 123,
    //         "formatted": {
    //           "price": "123.00 ₪",
    //           "discountedPrice": "123.00 ₪"
    //         }
    //       },
    //       "priceData": {
    //         "currency": "ILS",
    //         "price": 123,
    //         "discountedPrice": 123,
    //         "formatted": {
    //           "price": "123.00 ₪",
    //           "discountedPrice": "123.00 ₪"
    //         }
    //       },
    //       "additionalInfoSections": [
    //       ],
    //       "ribbons": [
    //       ],
    //       "media": {
    //         "items": [
    //         ]
    //       },
    //       "customTextFields": [
    //       ],
    //       "manageVariants": false,
    //       "productOptions": [
    //       ],
    //       "productPageUrl": {
    //         "base": "https://www.my-website.com/",
    //         "path": "/product-page/digital-product"
    //       },
    //       "numericId": "1544009414325000",
    //       "inventoryItemId": "9af80298-6b1a-ef50-8c1b-2de987ad2a43",
    //       "discount": {
    //         "type": "NONE",
    //         "value": 0
    //       },
    //       "collectionIds": [
    //         "ae886d55-2572-eee8-b2c4-13219844b5e4"
    //       ],
    //       "variants": [
    //       ]
    //     }
    //   ],
    //   "metadata": {
    //     "items": 100,
    //     "offset": 0
    //   },
    //   "totalResults": 2
    // }

    // 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 "metadata.items" To iMetadataItems
    Get ComIntOf Of hoJResp "metadata.offset" To iMetadataOffset
    Get ComIntOf Of hoJResp "totalResults" To iTotalResults
    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].name" To sName
        Get ComStringOf Of hoJResp "products[i].slug" To sSlug
        Get ComBoolOf Of hoJResp "products[i].visible" To iVisible
        Get ComStringOf Of hoJResp "products[i].productType" To sProductType
        Get ComStringOf Of hoJResp "products[i].description" To sDescription
        Get ComBoolOf Of hoJResp "products[i].stock.trackInventory" To iStockTrackInventory
        Get ComIntOf Of hoJResp "products[i].stock.quantity" To iStockQuantity
        Get ComBoolOf Of hoJResp "products[i].stock.inStock" To iStockInStock
        Get ComStringOf Of hoJResp "products[i].price.currency" To sPriceCurrency
        Get ComIntOf Of hoJResp "products[i].price.price" To iPricePrice
        Get ComIntOf Of hoJResp "products[i].price.discountedPrice" To iPriceDiscountedPrice
        Get ComStringOf Of hoJResp "products[i].price.formatted.price" To sPriceFormattedPrice
        Get ComStringOf Of hoJResp "products[i].price.formatted.discountedPrice" To sPriceFormattedDiscountedPrice
        Get ComStringOf Of hoJResp "products[i].priceData.currency" To sPriceDataCurrency
        Get ComIntOf Of hoJResp "products[i].priceData.price" To iPriceDataPrice
        Get ComIntOf Of hoJResp "products[i].priceData.discountedPrice" To iPriceDataDiscountedPrice
        Get ComStringOf Of hoJResp "products[i].priceData.formatted.price" To sPriceDataFormattedPrice
        Get ComStringOf Of hoJResp "products[i].priceData.formatted.discountedPrice" To sPriceDataFormattedDiscountedPrice
        Get ComBoolOf Of hoJResp "products[i].manageVariants" To iManageVariants
        Get ComStringOf Of hoJResp "products[i].productPageUrl.base" To sProductPageUrlBase
        Get ComStringOf Of hoJResp "products[i].productPageUrl.path" To sProductPageUrlPath
        Get ComStringOf Of hoJResp "products[i].numericId" To sNumericId
        Get ComStringOf Of hoJResp "products[i].inventoryItemId" To sInventoryItemId
        Get ComStringOf Of hoJResp "products[i].discount.type" To sDiscountType
        Get ComIntOf Of hoJResp "products[i].discount.value" To iDiscountValue
        Get ComStringOf Of hoJResp "products[i].sku" To sSku
        Get ComIntOf Of hoJResp "products[i].weight" To iWeight
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "products[i].additionalInfoSections" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "products[i].ribbons" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "products[i].ribbons[j].text" To sText
            Move (j + 1) To j
        Loop

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

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

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

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "products[i].collectionIds" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "products[i].collectionIds[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "products[i].variants" 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.