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

AutoIt 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

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

 

 

 

(AutoIt) WooCommerce List All Products

See more WooCommerce Examples

Gets WooCommerce product information in JSON format.

For more information, see https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

; Implements the following CURL command:

; curl https://example.com/wp-json/wc/v3/products \
;     -u consumer_key:consumer_secret

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

$oHttp.BasicAuth = True
$oHttp.Login = "consumer_key"
$oHttp.Password = "consumer_secret"

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://example.com/wp-json/wc/v3/products",$oSbResponseBody)
If ($bSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oJarrResp = ObjCreate("Chilkat_9_5_0.JsonArray")
$oJarrResp.LoadSb($oSbResponseBody)
$oJarrResp.EmitCompact = False

ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJarrResp.Emit() & @CRLF)

Local $iRespStatusCode = $oHttp.LastStatus
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oHttp.LastHeader & @CRLF)
    ConsoleWrite("Failed." & @CRLF)
    Exit
EndIf

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

; [
;   {
;     "id": 799,
;     "name": "Ship Your Idea",
;     "slug": "ship-your-idea-22",
;     "permalink": "https://example.com/product/ship-your-idea-22/",
;     "date_created": "2017-03-23T17:03:12",
;     "date_created_gmt": "2017-03-23T20:03:12",
;     "date_modified": "2017-03-23T17:03:12",
;     "date_modified_gmt": "2017-03-23T20:03:12",
;     "type": "variable",
;     "status": "publish",
;     "featured": false,
;     "catalog_visibility": "visible",
;     "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
;     "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
;     "sku": "",
;     "price": "",
;     "regular_price": "",
;     "sale_price": "",
;     "date_on_sale_from": null,
;     "date_on_sale_from_gmt": null,
;     "date_on_sale_to": null,
;     "date_on_sale_to_gmt": null,
;     "price_html": "",
;     "on_sale": false,
;     "purchasable": false,
;     "total_sales": 0,
;     "virtual": false,
;     "downloadable": false,
;     "downloads": [
;     ],
;     "download_limit": -1,
;     "download_expiry": -1,
;     "external_url": "",
;     "button_text": "",
;     "tax_status": "taxable",
;     "tax_class": "",
;     "manage_stock": false,
;     "stock_quantity": null,
;     "stock_status": "instock",
;     "backorders": "no",
;     "backorders_allowed": false,
;     "backordered": false,
;     "sold_individually": false,
;     "weight": "",
;     "dimensions": {
;       "length": "",
;       "width": "",
;       "height": ""
;     },
;     "shipping_required": true,
;     "shipping_taxable": true,
;     "shipping_class": "",
;     "shipping_class_id": 0,
;     "reviews_allowed": true,
;     "average_rating": "0.00",
;     "rating_count": 0,
;     "related_ids": [
;       31,
;       22,
;       369,
;       414,
;       56
;     ],
;     "upsell_ids": [
;     ],
;     "cross_sell_ids": [
;     ],
;     "parent_id": 0,
;     "purchase_note": "",
;     "categories": [
;       {
;         "id": 9,
;         "name": "Clothing",
;         "slug": "clothing"
;       },
;       {
;         "id": 14,
;         "name": "T-shirts",
;         "slug": "t-shirts"
;       }
;     ],
;     "tags": [
;     ],
;     "images": [
;       {
;         "id": 795,
;         "date_created": "2017-03-23T14:03:08",
;         "date_created_gmt": "2017-03-23T20:03:08",
;         "date_modified": "2017-03-23T14:03:08",
;         "date_modified_gmt": "2017-03-23T20:03:08",
;         "src": "https://example.com/wp-content/uploads/2017/03/T_4_front-11.jpg",
;         "name": "",
;         "alt": ""
;       },
;       {
;         "id": 796,
;         "date_created": "2017-03-23T14:03:09",
;         "date_created_gmt": "2017-03-23T20:03:09",
;         "date_modified": "2017-03-23T14:03:09",
;         "date_modified_gmt": "2017-03-23T20:03:09",
;         "src": "https://example.com/wp-content/uploads/2017/03/T_4_back-10.jpg",
;         "name": "",
;         "alt": ""
;       },
;       {
;         "id": 797,
;         "date_created": "2017-03-23T14:03:10",
;         "date_created_gmt": "2017-03-23T20:03:10",
;         "date_modified": "2017-03-23T14:03:10",
;         "date_modified_gmt": "2017-03-23T20:03:10",
;         "src": "https://example.com/wp-content/uploads/2017/03/T_3_front-10.jpg",
;         "name": "",
;         "alt": ""
;       },
;       {
;         "id": 798,
;         "date_created": "2017-03-23T14:03:11",
;         "date_created_gmt": "2017-03-23T20:03:11",
;         "date_modified": "2017-03-23T14:03:11",
;         "date_modified_gmt": "2017-03-23T20:03:11",
;         "src": "https://example.com/wp-content/uploads/2017/03/T_3_back-10.jpg",
;         "name": "",
;         "alt": ""
;       }
;     ],
;     "attributes": [
;       {
;         "id": 6,
;         "name": "Color",
;         "position": 0,
;         "visible": false,
;         "variation": true,
;         "options": [
;           "Black",
;           "Green"
;         ]
;       },
;       {
;         "id": 0,
;         "name": "Size",
;         "position": 0,
;         "visible": true,
;         "variation": true,
;         "options": [
;           "S",
;           "M"
;         ]
;       }
;     ],
;     "default_attributes": [
;     ],
;     "variations": [
;     ],
;     "grouped_products": [
;     ],
;     "menu_order": 0,
;     "meta_data": [
;     ],
;     "_links": {
;       "self": [
;         {
;           "href": "https://example.com/wp-json/wc/v3/products/799"
;         }
;       ],
;       "collection": [
;         {
;           "href": "https://example.com/wp-json/wc/v3/products"
;         }
;       ]
;     }
;   },
;   {
;     "id": 794,
;     "name": "Premium Quality",
;     "slug": "premium-quality-19",
;     "permalink": "https://example.com/product/premium-quality-19/",
;     "date_created": "2017-03-23T17:01:14",
;     "date_created_gmt": "2017-03-23T20:01:14",
;     "date_modified": "2017-03-23T17:01:14",
;     "date_modified_gmt": "2017-03-23T20:01:14",
;     "type": "simple",
;     "status": "publish",
;     "featured": false,
;     "catalog_visibility": "visible",
;     "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
;     "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
;     "sku": "",
;     "price": "21.99",
;     "regular_price": "21.99",
;     "sale_price": "",
;     "date_on_sale_from": null,
;     "date_on_sale_from_gmt": null,
;     "date_on_sale_to": null,
;     "date_on_sale_to_gmt": null,
;     "price_html": "<span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>21.99</span>",
;     "on_sale": false,
;     "purchasable": true,
;     "total_sales": 0,
;     "virtual": false,
;     "downloadable": false,
;     "downloads": [
;     ],
;     "download_limit": -1,
;     "download_expiry": -1,
;     "external_url": "",
;     "button_text": "",
;     "tax_status": "taxable",
;     "tax_class": "",
;     "manage_stock": false,
;     "stock_quantity": null,
;     "stock_status": "instock",
;     "backorders": "no",
;     "backorders_allowed": false,
;     "backordered": false,
;     "sold_individually": false,
;     "weight": "",
;     "dimensions": {
;       "length": "",
;       "width": "",
;       "height": ""
;     },
;     "shipping_required": true,
;     "shipping_taxable": true,
;     "shipping_class": "",
;     "shipping_class_id": 0,
;     "reviews_allowed": true,
;     "average_rating": "0.00",
;     "rating_count": 0,
;     "related_ids": [
;       463,
;       47,
;       31,
;       387,
;       458
;     ],
;     "upsell_ids": [
;     ],
;     "cross_sell_ids": [
;     ],
;     "parent_id": 0,
;     "purchase_note": "",
;     "categories": [
;       {
;         "id": 9,
;         "name": "Clothing",
;         "slug": "clothing"
;       },
;       {
;         "id": 14,
;         "name": "T-shirts",
;         "slug": "t-shirts"
;       }
;     ],
;     "tags": [
;     ],
;     "images": [
;       {
;         "id": 792,
;         "date_created": "2017-03-23T14:01:13",
;         "date_created_gmt": "2017-03-23T20:01:13",
;         "date_modified": "2017-03-23T14:01:13",
;         "date_modified_gmt": "2017-03-23T20:01:13",
;         "src": "https://example.com/wp-content/uploads/2017/03/T_2_front-4.jpg",
;         "name": "",
;         "alt": ""
;       },
;       {
;         "id": 793,
;         "date_created": "2017-03-23T14:01:14",
;         "date_created_gmt": "2017-03-23T20:01:14",
;         "date_modified": "2017-03-23T14:01:14",
;         "date_modified_gmt": "2017-03-23T20:01:14",
;         "src": "https://example.com/wp-content/uploads/2017/03/T_2_back-2.jpg",
;         "name": "",
;         "alt": ""
;       }
;     ],
;     "attributes": [
;     ],
;     "default_attributes": [
;       {
;         "id": 6,
;         "name": "Color",
;         "option": "black"
;       },
;       {
;         "id": 0,
;         "name": "Size",
;         "option": "S"
;       }
;     ],
;     "variations": [
;     ],
;     "grouped_products": [
;     ],
;     "menu_order": 0,
;     "meta_data": [
;     ],
;     "_links": {
;       "self": [
;         {
;           "href": "https://example.com/wp-json/wc/v3/products/794"
;         }
;       ],
;       "collection": [
;         {
;           "href": "https://example.com/wp-json/wc/v3/products"
;         }
;       ]
;     }
;   }
; ]

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

$oDate_created = ObjCreate("Chilkat_9_5_0.DtObj")
$oDate_created_gmt = ObjCreate("Chilkat_9_5_0.DtObj")
$oDate_modified = ObjCreate("Chilkat_9_5_0.DtObj")
$oDate_modified_gmt = ObjCreate("Chilkat_9_5_0.DtObj")
$oDate_on_sale_from = ObjCreate("Chilkat_9_5_0.DtObj")
$oDate_on_sale_from_gmt = ObjCreate("Chilkat_9_5_0.DtObj")
$oDate_on_sale_to = ObjCreate("Chilkat_9_5_0.DtObj")
$oDate_on_sale_to_gmt = ObjCreate("Chilkat_9_5_0.DtObj")
Local $oJson
Local $id
Local $sName
Local $slug
Local $sPermalink
Local $sV_type
Local $status
Local $bFeatured
Local $sCatalog_visibility
Local $sDescription
Local $short_description
Local $sku
Local $sPrice
Local $sRegular_price
Local $sale_price
Local $sPrice_html
Local $bOn_sale
Local $bPurchasable
Local $iTotal_sales
Local $bV_virtual
Local $bDownloadable
Local $iDownload_limit
Local $iDownload_expiry
Local $sExternal_url
Local $sButton_text
Local $sTax_status
Local $sTax_class
Local $bManage_stock
Local $stock_quantity
Local $stock_status
Local $sBackorders
Local $backorders_allowed
Local $backordered
Local $bSold_individually
Local $sWeight
Local $sDimensionsLength
Local $sDimensionsWidth
Local $sDimensionsHeight
Local $bShipping_required
Local $bShipping_taxable
Local $shipping_class
Local $iShipping_class_id
Local $bReviews_allowed
Local $sAverage_rating
Local $iRating_count
Local $iParent_id
Local $sPurchase_note
Local $iMenu_order
Local $iJ
Local $iCount_j
Local $intVal
Local $src
Local $sAlt
Local $iPosition
Local $bVisible
Local $bVariation
Local $iK
Local $iCount_k
Local $strVal
Local $sV_option
Local $sHref

Local $i = 0
Local $iCount_i = $oJarrResp.Size
While $i < $iCount_i
    $oJson = $oJarrResp.ObjectAt($i)
    $id = $oJson.IntOf("id")
    $sName = $oJson.StringOf("name")
    $slug = $oJson.StringOf("slug")
    $sPermalink = $oJson.StringOf("permalink")
    $oJson.DtOf("date_created",False,$oDate_created)
    $oJson.DtOf("date_created_gmt",False,$oDate_created_gmt)
    $oJson.DtOf("date_modified",False,$oDate_modified)
    $oJson.DtOf("date_modified_gmt",False,$oDate_modified_gmt)
    $sV_type = $oJson.StringOf("type")
    $status = $oJson.StringOf("status")
    $bFeatured = $oJson.BoolOf("featured")
    $sCatalog_visibility = $oJson.StringOf("catalog_visibility")
    $sDescription = $oJson.StringOf("description")
    $short_description = $oJson.StringOf("short_description")
    $sku = $oJson.StringOf("sku")
    $sPrice = $oJson.StringOf("price")
    $sRegular_price = $oJson.StringOf("regular_price")
    $sale_price = $oJson.StringOf("sale_price")
    $oJson.DtOf("date_on_sale_from",False,$oDate_on_sale_from)
    $oJson.DtOf("date_on_sale_from_gmt",False,$oDate_on_sale_from_gmt)
    $oJson.DtOf("date_on_sale_to",False,$oDate_on_sale_to)
    $oJson.DtOf("date_on_sale_to_gmt",False,$oDate_on_sale_to_gmt)
    $sPrice_html = $oJson.StringOf("price_html")
    $bOn_sale = $oJson.BoolOf("on_sale")
    $bPurchasable = $oJson.BoolOf("purchasable")
    $iTotal_sales = $oJson.IntOf("total_sales")
    $bV_virtual = $oJson.BoolOf("virtual")
    $bDownloadable = $oJson.BoolOf("downloadable")
    $iDownload_limit = $oJson.IntOf("download_limit")
    $iDownload_expiry = $oJson.IntOf("download_expiry")
    $sExternal_url = $oJson.StringOf("external_url")
    $sButton_text = $oJson.StringOf("button_text")
    $sTax_status = $oJson.StringOf("tax_status")
    $sTax_class = $oJson.StringOf("tax_class")
    $bManage_stock = $oJson.BoolOf("manage_stock")
    $stock_quantity = $oJson.StringOf("stock_quantity")
    $stock_status = $oJson.StringOf("stock_status")
    $sBackorders = $oJson.StringOf("backorders")
    $backorders_allowed = $oJson.BoolOf("backorders_allowed")
    $backordered = $oJson.BoolOf("backordered")
    $bSold_individually = $oJson.BoolOf("sold_individually")
    $sWeight = $oJson.StringOf("weight")
    $sDimensionsLength = $oJson.StringOf("dimensions.length")
    $sDimensionsWidth = $oJson.StringOf("dimensions.width")
    $sDimensionsHeight = $oJson.StringOf("dimensions.height")
    $bShipping_required = $oJson.BoolOf("shipping_required")
    $bShipping_taxable = $oJson.BoolOf("shipping_taxable")
    $shipping_class = $oJson.StringOf("shipping_class")
    $iShipping_class_id = $oJson.IntOf("shipping_class_id")
    $bReviews_allowed = $oJson.BoolOf("reviews_allowed")
    $sAverage_rating = $oJson.StringOf("average_rating")
    $iRating_count = $oJson.IntOf("rating_count")
    $iParent_id = $oJson.IntOf("parent_id")
    $sPurchase_note = $oJson.StringOf("purchase_note")
    $iMenu_order = $oJson.IntOf("menu_order")
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("downloads")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("related_ids")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $intVal = $oJson.IntOf("related_ids[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("upsell_ids")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("cross_sell_ids")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("categories")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $id = $oJson.IntOf("categories[j].id")
        $sName = $oJson.StringOf("categories[j].name")
        $slug = $oJson.StringOf("categories[j].slug")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("tags")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("images")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $id = $oJson.IntOf("images[j].id")
        $oJson.DtOf("images[j].date_created",False,$oDate_created)
        $oJson.DtOf("images[j].date_created_gmt",False,$oDate_created_gmt)
        $oJson.DtOf("images[j].date_modified",False,$oDate_modified)
        $oJson.DtOf("images[j].date_modified_gmt",False,$oDate_modified_gmt)
        $src = $oJson.StringOf("images[j].src")
        $sName = $oJson.StringOf("images[j].name")
        $sAlt = $oJson.StringOf("images[j].alt")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("attributes")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $id = $oJson.IntOf("attributes[j].id")
        $sName = $oJson.StringOf("attributes[j].name")
        $iPosition = $oJson.IntOf("attributes[j].position")
        $bVisible = $oJson.BoolOf("attributes[j].visible")
        $bVariation = $oJson.BoolOf("attributes[j].variation")
        $iK = 0
        $iCount_k = $oJson.SizeOfArray("attributes[j].options")
        While $iK < $iCount_k
            $oJson.K = $iK
            $strVal = $oJson.StringOf("attributes[j].options[k]")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("default_attributes")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $id = $oJson.IntOf("default_attributes[j].id")
        $sName = $oJson.StringOf("default_attributes[j].name")
        $sV_option = $oJson.StringOf("default_attributes[j].option")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("variations")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("grouped_products")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("meta_data")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("_links.self")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $sHref = $oJson.StringOf("_links.self[j].href")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("_links.collection")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $sHref = $oJson.StringOf("_links.collection[j].href")
        $iJ = $iJ + 1
    Wend

    $i = $i + 1
Wend

 

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