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) Shopify Get all products that belong to a certain collection

Get all products that belong to a certain collection

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoRest
    Boolean iSuccess
    Variant vSbJson
    Handle hoSbJson
    Handle hoJson
    Integer i
    Integer iCount_i
    Integer iId
    String sTitle
    String sBody_html
    String sVendor
    String sProduct_type
    String sCreated_at
    String sHandle
    String sUpdated_at
    String sPublished_at
    Boolean iTemplate_suffix
    String sPublished_scope
    String sTags
    Integer iImageId
    Integer iImageProduct_id
    Integer iImagePosition
    String sImageCreated_at
    String sImageUpdated_at
    Integer iImageWidth
    Integer iImageHeight
    String sImageSrc
    Integer j
    Integer iCount_j
    Integer iProduct_id
    String sPrice
    String sSku
    Integer iPosition
    Integer iGrams
    String sInventory_policy
    Boolean iCompare_at_price
    String sFulfillment_service
    String sInventory_management
    String sOption1
    Boolean iOption2
    Boolean iOption3
    Boolean iTaxable
    String sBarcode
    Integer iImage_id
    Integer iInventory_quantity
    Integer iWeight
    String sWeight_unit
    Integer iOld_inventory_quantity
    Boolean iRequires_shipping
    String sName
    Integer k
    Integer iCount_k
    String sStrVal
    Integer iWidth
    Integer iHeight
    String sSrc
    Integer iIntVal
    String sTemp1
    Integer iTemp1

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End

    Get ComSetAuthBasic Of hoRest "SHOPIFY_PRIVATE_API_KEY" "SHOPIFY_PRIVATE_API_KEY" To iSuccess

    Get ComConnect Of hoRest "chilkat.myshopify.com" 443 True True To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbJson
    If (Not(IsComObjectCreated(hoSbJson))) Begin
        Send CreateComObject of hoSbJson
    End
    Get pvComObject of hoSbJson to vSbJson
    Get ComFullRequestNoBodySb Of hoRest "GET" "/admin/products.json?collection_id=841564295" vSbJson To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComResponseStatusCode Of hoRest To iTemp1
    If (iTemp1 <> 200) Begin
        Get ComResponseStatusCode Of hoRest To iTemp1
        Showln "Received error response code: " iTemp1
        Showln "Response body:"
        Get ComGetAsString Of hoSbJson To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get pvComObject of hoSbJson to vSbJson
    Get ComLoadSb Of hoJson vSbJson To iSuccess

    // The following code parses the JSON response.
    // A sample JSON response is shown below the sample code.

    Move 0 To i
    Get ComSizeOfArray Of hoJson "products" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComIntOf Of hoJson "products[i].id" To iId
        Get ComStringOf Of hoJson "products[i].title" To sTitle
        Get ComStringOf Of hoJson "products[i].body_html" To sBody_html
        Get ComStringOf Of hoJson "products[i].vendor" To sVendor
        Get ComStringOf Of hoJson "products[i].product_type" To sProduct_type
        Get ComStringOf Of hoJson "products[i].created_at" To sCreated_at
        Get ComStringOf Of hoJson "products[i].handle" To sHandle
        Get ComStringOf Of hoJson "products[i].updated_at" To sUpdated_at
        Get ComStringOf Of hoJson "products[i].published_at" To sPublished_at
        Get ComIsNullOf Of hoJson "products[i].template_suffix" To iTemplate_suffix
        Get ComStringOf Of hoJson "products[i].published_scope" To sPublished_scope
        Get ComStringOf Of hoJson "products[i].tags" To sTags
        Get ComIntOf Of hoJson "products[i].image.id" To iImageId
        Get ComIntOf Of hoJson "products[i].image.product_id" To iImageProduct_id
        Get ComIntOf Of hoJson "products[i].image.position" To iImagePosition
        Get ComStringOf Of hoJson "products[i].image.created_at" To sImageCreated_at
        Get ComStringOf Of hoJson "products[i].image.updated_at" To sImageUpdated_at
        Get ComIntOf Of hoJson "products[i].image.width" To iImageWidth
        Get ComIntOf Of hoJson "products[i].image.height" To iImageHeight
        Get ComStringOf Of hoJson "products[i].image.src" To sImageSrc
        Move 0 To j
        Get ComSizeOfArray Of hoJson "products[i].variants" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComIntOf Of hoJson "products[i].variants[j].id" To iId
            Get ComIntOf Of hoJson "products[i].variants[j].product_id" To iProduct_id
            Get ComStringOf Of hoJson "products[i].variants[j].title" To sTitle
            Get ComStringOf Of hoJson "products[i].variants[j].price" To sPrice
            Get ComStringOf Of hoJson "products[i].variants[j].sku" To sSku
            Get ComIntOf Of hoJson "products[i].variants[j].position" To iPosition
            Get ComIntOf Of hoJson "products[i].variants[j].grams" To iGrams
            Get ComStringOf Of hoJson "products[i].variants[j].inventory_policy" To sInventory_policy
            Get ComIsNullOf Of hoJson "products[i].variants[j].compare_at_price" To iCompare_at_price
            Get ComStringOf Of hoJson "products[i].variants[j].fulfillment_service" To sFulfillment_service
            Get ComStringOf Of hoJson "products[i].variants[j].inventory_management" To sInventory_management
            Get ComStringOf Of hoJson "products[i].variants[j].option1" To sOption1
            Get ComIsNullOf Of hoJson "products[i].variants[j].option2" To iOption2
            Get ComIsNullOf Of hoJson "products[i].variants[j].option3" To iOption3
            Get ComStringOf Of hoJson "products[i].variants[j].created_at" To sCreated_at
            Get ComStringOf Of hoJson "products[i].variants[j].updated_at" To sUpdated_at
            Get ComBoolOf Of hoJson "products[i].variants[j].taxable" To iTaxable
            Get ComStringOf Of hoJson "products[i].variants[j].barcode" To sBarcode
            Get ComIntOf Of hoJson "products[i].variants[j].image_id" To iImage_id
            Get ComIntOf Of hoJson "products[i].variants[j].inventory_quantity" To iInventory_quantity
            Get ComIntOf Of hoJson "products[i].variants[j].weight" To iWeight
            Get ComStringOf Of hoJson "products[i].variants[j].weight_unit" To sWeight_unit
            Get ComIntOf Of hoJson "products[i].variants[j].old_inventory_quantity" To iOld_inventory_quantity
            Get ComBoolOf Of hoJson "products[i].variants[j].requires_shipping" To iRequires_shipping
            Move j + 1 To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "products[i].options" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComIntOf Of hoJson "products[i].options[j].id" To iId
            Get ComIntOf Of hoJson "products[i].options[j].product_id" To iProduct_id
            Get ComStringOf Of hoJson "products[i].options[j].name" To sName
            Get ComIntOf Of hoJson "products[i].options[j].position" To iPosition
            Move 0 To k
            Get ComSizeOfArray Of hoJson "products[i].options[j].values" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJson To k
                Get ComStringOf Of hoJson "products[i].options[j].values[k]" To sStrVal
                Move k + 1 To k
            Loop

            Move j + 1 To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "products[i].images" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComIntOf Of hoJson "products[i].images[j].id" To iId
            Get ComIntOf Of hoJson "products[i].images[j].product_id" To iProduct_id
            Get ComIntOf Of hoJson "products[i].images[j].position" To iPosition
            Get ComStringOf Of hoJson "products[i].images[j].created_at" To sCreated_at
            Get ComStringOf Of hoJson "products[i].images[j].updated_at" To sUpdated_at
            Get ComIntOf Of hoJson "products[i].images[j].width" To iWidth
            Get ComIntOf Of hoJson "products[i].images[j].height" To iHeight
            Get ComStringOf Of hoJson "products[i].images[j].src" To sSrc
            Move 0 To k
            Get ComSizeOfArray Of hoJson "products[i].images[j].variant_ids" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJson To k
                Get ComIntOf Of hoJson "products[i].images[j].variant_ids[k]" To iIntVal
                Move k + 1 To k
            Loop

            Move j + 1 To j
        Loop

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

        Move i + 1 To i
    Loop

    // A sample JSON response body that is parsed by the above code:

    // {
    //   "products": [
    //     {
    //       "id": 632910392,
    //       "title": "IPod Nano - 8GB",
    //       "body_html": "<p>It's the small iPod with one very big idea: Video. Now the world's most popular music player, available in 4GB and 8GB models, lets you enjoy TV shows, movies, video podcasts, and more. The larger, brighter display means amazing picture quality. In six eye-catching colors, iPod nano is stunning all around. And with models starting at just $149, little speaks volumes.<\/p>",
    //       "vendor": "Apple",
    //       "product_type": "Cult Products",
    //       "created_at": "2017-09-22T14:08:02-04:00",
    //       "handle": "ipod-nano",
    //       "updated_at": "2017-09-22T14:08:02-04:00",
    //       "published_at": "2007-12-31T19:00:00-05:00",
    //       "template_suffix": null,
    //       "published_scope": "web",
    //       "tags": "Emotive, Flash Memory, MP3, Music",
    //       "variants": [
    //         {
    //           "id": 808950810,
    //           "product_id": 632910392,
    //           "title": "Pink",
    //           "price": "199.00",
    //           "sku": "IPOD2008PINK",
    //           "position": 1,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Pink",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_pink",
    //           "image_id": 562641783,
    //           "inventory_quantity": 10,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 10,
    //           "requires_shipping": true
    //         },
    //         {
    //           "id": 49148385,
    //           "product_id": 632910392,
    //           "title": "Red",
    //           "price": "199.00",
    //           "sku": "IPOD2008RED",
    //           "position": 2,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Red",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_red",
    //           "image_id": null,
    //           "inventory_quantity": 20,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 20,
    //           "requires_shipping": true
    //         },
    //         {
    //           "id": 39072856,
    //           "product_id": 632910392,
    //           "title": "Green",
    //           "price": "199.00",
    //           "sku": "IPOD2008GREEN",
    //           "position": 3,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Green",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_green",
    //           "image_id": null,
    //           "inventory_quantity": 30,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 30,
    //           "requires_shipping": true
    //         },
    //         {
    //           "id": 457924702,
    //           "product_id": 632910392,
    //           "title": "Black",
    //           "price": "199.00",
    //           "sku": "IPOD2008BLACK",
    //           "position": 4,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Black",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_black",
    //           "image_id": null,
    //           "inventory_quantity": 40,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 40,
    //           "requires_shipping": true
    //         }
    //       ],
    //       "options": [
    //         {
    //           "id": 594680422,
    //           "product_id": 632910392,
    //           "name": "Color",
    //           "position": 1,
    //           "values": [
    //             "Pink",
    //             "Red",
    //             "Green",
    //             "Black"
    //           ]
    //         }
    //       ],
    //       "images": [
    //         {
    //           "id": 850703190,
    //           "product_id": 632910392,
    //           "position": 1,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "width": 123,
    //           "height": 456,
    //           "src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano.png?v=1506103682",
    //           "variant_ids": [
    //           ]
    //         },
    //         {
    //           "id": 562641783,
    //           "product_id": 632910392,
    //           "position": 2,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "width": 123,
    //           "height": 456,
    //           "src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano-2.png?v=1506103682",
    //           "variant_ids": [
    //             808950810
    //           ]
    //         }
    //       ],
    //       "image": {
    //         "id": 850703190,
    //         "product_id": 632910392,
    //         "position": 1,
    //         "created_at": "2017-09-22T14:08:02-04:00",
    //         "updated_at": "2017-09-22T14:08:02-04:00",
    //         "width": 123,
    //         "height": 456,
    //         "src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano.png?v=1506103682",
    //         "variant_ids": [
    //         ]
    //       }
    //     }
    //   ]
    // }

    Showln "Example Completed."


End_Procedure

 

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