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

Retrieve a list of all product objects from this shop.

For more information, see https://developers.lightspeedhq.com/ecom/endpoints/product/#get-all-products

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 iId
    Integer iSortOrder
    String sName
    Integer j
    Integer iCount_j
    Integer iProductId
    String sProductCreatedAt
    String sProductUpdatedAt
    Boolean iProductIsVisible
    String sProductVisibility
    Boolean iProductHasMatrix
    String sProductData01
    String sProductData02
    String sProductData03
    String sProductUrl
    String sProductTitle
    String sProductFulltitle
    String sProductDescription
    String sProductContent
    Integer iProductSetId
    String sProductSetCreatedAt
    String sProductSetUpdatedAt
    String sProductSetName
    Integer iProductBrandResourceId
    String sProductBrandResourceUrl
    String sProductBrandResourceLink
    Boolean iProductCategoriesResourceId
    String sProductCategoriesResourceUrl
    String sProductCategoriesResourceLink
    Integer iProductDeliverydateResourceId
    String sProductDeliverydateResourceUrl
    String sProductDeliverydateResourceLink
    String sProductImageCreatedAt
    String sProductImageUpdatedAt
    String sProductImageExtension
    Integer iProductImageSize
    String sProductImageTitle
    String sProductImageThumb
    String sProductImageSrc
    Boolean iProductImagesResourceId
    String sProductImagesResourceUrl
    String sProductImagesResourceLink
    Boolean iProductRelationsResourceId
    String sProductRelationsResourceUrl
    String sProductRelationsResourceLink
    Boolean iProductMetafieldsResourceId
    String sProductMetafieldsResourceUrl
    String sProductMetafieldsResourceLink
    Boolean iProductReviewsResourceId
    String sProductReviewsResourceUrl
    String sProductReviewsResourceLink
    Boolean iProductType
    Boolean iProductAttributesResourceId
    String sProductAttributesResourceUrl
    String sProductAttributesResourceLink
    Integer iProductSupplierResourceId
    String sProductSupplierResourceUrl
    String sProductSupplierResourceLink
    Boolean iProductTagsResourceId
    String sProductTagsResourceUrl
    String sProductTagsResourceLink
    Boolean iProductVariantsResourceId
    String sProductVariantsResourceUrl
    String sProductVariantsResourceLink
    Boolean iProductMovementsResourceId
    String sProductMovementsResourceUrl
    String sProductMovementsResourceLink
    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.shoplightspeed.com/en/products.json \
    //   -u {key}:{secret}

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

    Set ComLogin Of hoHttp To "API_KEY"
    Set ComPassword Of hoHttp To "API_SECRET"

    // Use the correct cluster for your shop.  Here are the choices:
    // eu1 https://api.webshopapp.com/en/
    // us1 https://api.shoplightspeed.com/en/
    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.webshopapp.com/en/products.json" 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)

    // {
    //   "product": {
    //     "id": 20967267,
    //     "createdAt": "2019-05-28T15:25:46+00:00",
    //     "updatedAt": "2019-05-28T17:16:16+00:00",
    //     "isVisible": true,
    //     "visibility": "visible",
    //     "hasMatrix": false,
    //     "data01": "",
    //     "data02": "",
    //     "data03": "",
    //     "url": "lookin-sharp-tee",
    //     "title": "Lookin' Sharp T-Shirt",
    //     "fulltitle": "Lookin' Sharp T-Shirt",
    //     "description": "Description of the Lookin' Sharp T-Shirt",
    //     "content": "<p>Long Description of the Lookin' Sharp T-Shirt</p>",
    //     "set": {
    //       "id": 2785,
    //       "createdAt": "2019-05-28T15:32:12+00:00",
    //       "updatedAt": "2019-05-28T15:42:59+00:00",
    //       "name": "Shirts",
    //       "options": [
    //         {
    //           "id": 4626,
    //           "sortOrder": 1,
    //           "name": "Size",
    //           "values": [
    //             {
    //               "id": 14045,
    //               "sortOrder": 1,
    //               "name": "S"
    //             },
    //             {
    //               "id": 14046,
    //               "sortOrder": 2,
    //               "name": "M"
    //             },
    //             {
    //               "id": 14047,
    //               "sortOrder": 3,
    //               "name": "L"
    //             }
    //           ]
    //         }
    //       ]
    //     },
    //     "brand": {
    //       "resource": {
    //         "id": 1171202,
    //         "url": "brands/1171202",
    //         "link": "https://api.shoplightspeed.com/us/brands/1171202.json"
    //       }
    //     },
    //     "categories": {
    //       "resource": {
    //         "id": false,
    //         "url": "categories/products?product=20967267",
    //         "link": "https://api.shoplightspeed.com/us/categories/products.json?product=20967267"
    //       }
    //     },
    //     "deliverydate": {
    //       "resource": {
    //         "id": 6488,
    //         "url": "deliverydates/6488",
    //         "link": "https://api.shoplightspeed.com/us/deliverydates/6488.json"
    //       }
    //     },
    //     "image": {
    //       "createdAt": "2019-05-28T15:25:46+00:00",
    //       "updatedAt": "2019-05-28T15:25:46+00:00",
    //       "extension": "jpg",
    //       "size": 86649,
    //       "title": "17x35x-jcfk-88na-udwd-5hck-z63u-img-16-e0aa4f57-f4",
    //       "thumb": "https://cdn.shoplightspeed.com/shops/000001/files/14119398/50x50x2/17x35x-jcfk-88na-udwd-5hck-z63u-img-16-e0aa4f57-f4.jpg",
    //       "src": "https://cdn.shoplightspeed.com/shops/000001/files/14119398/17x35x-jcfk-88na-udwd-5hck-z63u-img-16-e0aa4f57-f4.jpg"
    //     },
    //     "images": {
    //       "resource": {
    //         "id": false,
    //         "url": "products/20967267/images",
    //         "link": "https://api.shoplightspeed.com/us/products/20967267/images.json"
    //       }
    //     },
    //     "relations": {
    //       "resource": {
    //         "id": false,
    //         "url": "products/20967267/relations",
    //         "link": "https://api.shoplightspeed.com/us/products/20967267/relations.json"
    //       }
    //     },
    //     "metafields": {
    //       "resource": {
    //         "id": false,
    //         "url": "products/20967267/metafields",
    //         "link": "https://api.shoplightspeed.com/us/products/20967267/metafields.json"
    //       }
    //     },
    //     "reviews": {
    //       "resource": {
    //         "id": false,
    //         "url": "reviews?product=20967267",
    //         "link": "https://api.shoplightspeed.com/us/reviews.json?product=20967267"
    //       }
    //     },
    //     "type": false,
    //     "attributes": {
    //       "resource": {
    //         "id": false,
    //         "url": "products/20967267/attributes",
    //         "link": "https://api.shoplightspeed.com/us/products/20967267/attributes.json"
    //       }
    //     },
    //     "supplier": {
    //       "resource": {
    //         "id": 78794,
    //         "url": "suppliers/78794",
    //         "link": "https://api.shoplightspeed.com/us/suppliers/78794.json"
    //       }
    //     },
    //     "tags": {
    //       "resource": {
    //         "id": false,
    //         "url": "tags/products?product=20967267",
    //         "link": "https://api.shoplightspeed.com/us/tags/products.json?product=20967267"
    //       }
    //     },
    //     "variants": {
    //       "resource": {
    //         "id": false,
    //         "url": "variants?product=20967267",
    //         "link": "https://api.shoplightspeed.com/us/variants.json?product=20967267"
    //       }
    //     },
    //     "movements": {
    //       "resource": {
    //         "id": false,
    //         "url": "variants/movements?product=20967267",
    //         "link": "https://api.shoplightspeed.com/us/variants/movements.json?product=20967267"
    //       }
    //     }
    //   }
    // }

    // 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 "product.id" To iProductId
    Get ComStringOf Of hoJResp "product.createdAt" To sProductCreatedAt
    Get ComStringOf Of hoJResp "product.updatedAt" To sProductUpdatedAt
    Get ComBoolOf Of hoJResp "product.isVisible" To iProductIsVisible
    Get ComStringOf Of hoJResp "product.visibility" To sProductVisibility
    Get ComBoolOf Of hoJResp "product.hasMatrix" To iProductHasMatrix
    Get ComStringOf Of hoJResp "product.data01" To sProductData01
    Get ComStringOf Of hoJResp "product.data02" To sProductData02
    Get ComStringOf Of hoJResp "product.data03" To sProductData03
    Get ComStringOf Of hoJResp "product.url" To sProductUrl
    Get ComStringOf Of hoJResp "product.title" To sProductTitle
    Get ComStringOf Of hoJResp "product.fulltitle" To sProductFulltitle
    Get ComStringOf Of hoJResp "product.description" To sProductDescription
    Get ComStringOf Of hoJResp "product.content" To sProductContent
    Get ComIntOf Of hoJResp "product.set.id" To iProductSetId
    Get ComStringOf Of hoJResp "product.set.createdAt" To sProductSetCreatedAt
    Get ComStringOf Of hoJResp "product.set.updatedAt" To sProductSetUpdatedAt
    Get ComStringOf Of hoJResp "product.set.name" To sProductSetName
    Get ComIntOf Of hoJResp "product.brand.resource.id" To iProductBrandResourceId
    Get ComStringOf Of hoJResp "product.brand.resource.url" To sProductBrandResourceUrl
    Get ComStringOf Of hoJResp "product.brand.resource.link" To sProductBrandResourceLink
    Get ComBoolOf Of hoJResp "product.categories.resource.id" To iProductCategoriesResourceId
    Get ComStringOf Of hoJResp "product.categories.resource.url" To sProductCategoriesResourceUrl
    Get ComStringOf Of hoJResp "product.categories.resource.link" To sProductCategoriesResourceLink
    Get ComIntOf Of hoJResp "product.deliverydate.resource.id" To iProductDeliverydateResourceId
    Get ComStringOf Of hoJResp "product.deliverydate.resource.url" To sProductDeliverydateResourceUrl
    Get ComStringOf Of hoJResp "product.deliverydate.resource.link" To sProductDeliverydateResourceLink
    Get ComStringOf Of hoJResp "product.image.createdAt" To sProductImageCreatedAt
    Get ComStringOf Of hoJResp "product.image.updatedAt" To sProductImageUpdatedAt
    Get ComStringOf Of hoJResp "product.image.extension" To sProductImageExtension
    Get ComIntOf Of hoJResp "product.image.size" To iProductImageSize
    Get ComStringOf Of hoJResp "product.image.title" To sProductImageTitle
    Get ComStringOf Of hoJResp "product.image.thumb" To sProductImageThumb
    Get ComStringOf Of hoJResp "product.image.src" To sProductImageSrc
    Get ComBoolOf Of hoJResp "product.images.resource.id" To iProductImagesResourceId
    Get ComStringOf Of hoJResp "product.images.resource.url" To sProductImagesResourceUrl
    Get ComStringOf Of hoJResp "product.images.resource.link" To sProductImagesResourceLink
    Get ComBoolOf Of hoJResp "product.relations.resource.id" To iProductRelationsResourceId
    Get ComStringOf Of hoJResp "product.relations.resource.url" To sProductRelationsResourceUrl
    Get ComStringOf Of hoJResp "product.relations.resource.link" To sProductRelationsResourceLink
    Get ComBoolOf Of hoJResp "product.metafields.resource.id" To iProductMetafieldsResourceId
    Get ComStringOf Of hoJResp "product.metafields.resource.url" To sProductMetafieldsResourceUrl
    Get ComStringOf Of hoJResp "product.metafields.resource.link" To sProductMetafieldsResourceLink
    Get ComBoolOf Of hoJResp "product.reviews.resource.id" To iProductReviewsResourceId
    Get ComStringOf Of hoJResp "product.reviews.resource.url" To sProductReviewsResourceUrl
    Get ComStringOf Of hoJResp "product.reviews.resource.link" To sProductReviewsResourceLink
    Get ComBoolOf Of hoJResp "product.type" To iProductType
    Get ComBoolOf Of hoJResp "product.attributes.resource.id" To iProductAttributesResourceId
    Get ComStringOf Of hoJResp "product.attributes.resource.url" To sProductAttributesResourceUrl
    Get ComStringOf Of hoJResp "product.attributes.resource.link" To sProductAttributesResourceLink
    Get ComIntOf Of hoJResp "product.supplier.resource.id" To iProductSupplierResourceId
    Get ComStringOf Of hoJResp "product.supplier.resource.url" To sProductSupplierResourceUrl
    Get ComStringOf Of hoJResp "product.supplier.resource.link" To sProductSupplierResourceLink
    Get ComBoolOf Of hoJResp "product.tags.resource.id" To iProductTagsResourceId
    Get ComStringOf Of hoJResp "product.tags.resource.url" To sProductTagsResourceUrl
    Get ComStringOf Of hoJResp "product.tags.resource.link" To sProductTagsResourceLink
    Get ComBoolOf Of hoJResp "product.variants.resource.id" To iProductVariantsResourceId
    Get ComStringOf Of hoJResp "product.variants.resource.url" To sProductVariantsResourceUrl
    Get ComStringOf Of hoJResp "product.variants.resource.link" To sProductVariantsResourceLink
    Get ComBoolOf Of hoJResp "product.movements.resource.id" To iProductMovementsResourceId
    Get ComStringOf Of hoJResp "product.movements.resource.url" To sProductMovementsResourceUrl
    Get ComStringOf Of hoJResp "product.movements.resource.link" To sProductMovementsResourceLink
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "product.set.options" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComIntOf Of hoJResp "product.set.options[i].id" To iId
        Get ComIntOf Of hoJResp "product.set.options[i].sortOrder" To iSortOrder
        Get ComStringOf Of hoJResp "product.set.options[i].name" To sName
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "product.set.options[i].values" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComIntOf Of hoJResp "product.set.options[i].values[j].id" To iId
            Get ComIntOf Of hoJResp "product.set.options[i].values[j].sortOrder" To iSortOrder
            Get ComStringOf Of hoJResp "product.set.options[i].values[j].name" To sName
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

 

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