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

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

 

 

 

(Visual FoxPro) WooCommerce Delete a Product

See more WooCommerce Examples

Demonstrates how to delete a product from WooCommerce.

For more information, see https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-product

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL lnSuccess
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL loDate_created
LOCAL loDate_created_gmt
LOCAL loDate_modified
LOCAL loDate_modified_gmt
LOCAL loDate_on_sale_from
LOCAL loDate_on_sale_from_gmt
LOCAL loDate_on_sale_to
LOCAL loDate_on_sale_to_gmt
LOCAL lnIntVal
LOCAL lcSrc
LOCAL lcAlt
LOCAL lcHref
LOCAL lnId
LOCAL lcName
LOCAL lcSlug
LOCAL lcPermalink
LOCAL lcV_type
LOCAL lcStatus
LOCAL lnFeatured
LOCAL lcCatalog_visibility
LOCAL lcDescription
LOCAL lcShort_description
LOCAL lcSku
LOCAL lcPrice
LOCAL lcRegular_price
LOCAL lcSale_price
LOCAL lcPrice_html
LOCAL lnOn_sale
LOCAL lnPurchasable
LOCAL lnTotal_sales
LOCAL lnVirtual
LOCAL lnDownloadable
LOCAL lnDownload_limit
LOCAL lnDownload_expiry
LOCAL lcExternal_url
LOCAL lcButton_text
LOCAL lcTax_status
LOCAL lcTax_class
LOCAL lnManage_stock
LOCAL lcStock_quantity
LOCAL lcStock_status
LOCAL lcBackorders
LOCAL lnBackorders_allowed
LOCAL lnBackordered
LOCAL lnSold_individually
LOCAL lcWeight
LOCAL lcDimensionsLength
LOCAL lcDimensionsWidth
LOCAL lcDimensionsHeight
LOCAL lnShipping_required
LOCAL lnShipping_taxable
LOCAL lcShipping_class
LOCAL lnShipping_class_id
LOCAL lnReviews_allowed
LOCAL lcAverage_rating
LOCAL lnRating_count
LOCAL lnParent_id
LOCAL lcPurchase_note
LOCAL lnMenu_order
LOCAL i
LOCAL lnCount_i

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

* Implements the following CURL command:

* curl -X DELETE https://example.com/wp-json/wc/v3/products/794?force=true \
*     -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

loHttp.BasicAuth = 1
loHttp.Login = "consumer_key"
loHttp.Password = "consumer_secret"

loResp = loHttp.QuickRequest("DELETE","https://example.com/wp-json/wc/v3/products/794?force=true")
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

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

* {
*   "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": "24.54",
*   "regular_price": "24.54",
*   "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>24.54</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": [
*     479,
*     387,
*     22,
*     463,
*     396
*   ],
*   "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": [
*   ],
*   "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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.DtObj')
loDate_created = CreateObject('Chilkat.DtObj')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.DtObj')
loDate_created_gmt = CreateObject('Chilkat.DtObj')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.DtObj')
loDate_modified = CreateObject('Chilkat.DtObj')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.DtObj')
loDate_modified_gmt = CreateObject('Chilkat.DtObj')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.DtObj')
loDate_on_sale_from = CreateObject('Chilkat.DtObj')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.DtObj')
loDate_on_sale_from_gmt = CreateObject('Chilkat.DtObj')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.DtObj')
loDate_on_sale_to = CreateObject('Chilkat.DtObj')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.DtObj')
loDate_on_sale_to_gmt = CreateObject('Chilkat.DtObj')

lnId = loJResp.IntOf("id")
lcName = loJResp.StringOf("name")
lcSlug = loJResp.StringOf("slug")
lcPermalink = loJResp.StringOf("permalink")
loJResp.DtOf("date_created",0,loDate_created)
loJResp.DtOf("date_created_gmt",0,loDate_created_gmt)
loJResp.DtOf("date_modified",0,loDate_modified)
loJResp.DtOf("date_modified_gmt",0,loDate_modified_gmt)
lcV_type = loJResp.StringOf("type")
lcStatus = loJResp.StringOf("status")
lnFeatured = loJResp.BoolOf("featured")
lcCatalog_visibility = loJResp.StringOf("catalog_visibility")
lcDescription = loJResp.StringOf("description")
lcShort_description = loJResp.StringOf("short_description")
lcSku = loJResp.StringOf("sku")
lcPrice = loJResp.StringOf("price")
lcRegular_price = loJResp.StringOf("regular_price")
lcSale_price = loJResp.StringOf("sale_price")
loJResp.DtOf("date_on_sale_from",0,loDate_on_sale_from)
loJResp.DtOf("date_on_sale_from_gmt",0,loDate_on_sale_from_gmt)
loJResp.DtOf("date_on_sale_to",0,loDate_on_sale_to)
loJResp.DtOf("date_on_sale_to_gmt",0,loDate_on_sale_to_gmt)
lcPrice_html = loJResp.StringOf("price_html")
lnOn_sale = loJResp.BoolOf("on_sale")
lnPurchasable = loJResp.BoolOf("purchasable")
lnTotal_sales = loJResp.IntOf("total_sales")
lnVirtual = loJResp.BoolOf("virtual")
lnDownloadable = loJResp.BoolOf("downloadable")
lnDownload_limit = loJResp.IntOf("download_limit")
lnDownload_expiry = loJResp.IntOf("download_expiry")
lcExternal_url = loJResp.StringOf("external_url")
lcButton_text = loJResp.StringOf("button_text")
lcTax_status = loJResp.StringOf("tax_status")
lcTax_class = loJResp.StringOf("tax_class")
lnManage_stock = loJResp.BoolOf("manage_stock")
lcStock_quantity = loJResp.StringOf("stock_quantity")
lcStock_status = loJResp.StringOf("stock_status")
lcBackorders = loJResp.StringOf("backorders")
lnBackorders_allowed = loJResp.BoolOf("backorders_allowed")
lnBackordered = loJResp.BoolOf("backordered")
lnSold_individually = loJResp.BoolOf("sold_individually")
lcWeight = loJResp.StringOf("weight")
lcDimensionsLength = loJResp.StringOf("dimensions.length")
lcDimensionsWidth = loJResp.StringOf("dimensions.width")
lcDimensionsHeight = loJResp.StringOf("dimensions.height")
lnShipping_required = loJResp.BoolOf("shipping_required")
lnShipping_taxable = loJResp.BoolOf("shipping_taxable")
lcShipping_class = loJResp.StringOf("shipping_class")
lnShipping_class_id = loJResp.IntOf("shipping_class_id")
lnReviews_allowed = loJResp.BoolOf("reviews_allowed")
lcAverage_rating = loJResp.StringOf("average_rating")
lnRating_count = loJResp.IntOf("rating_count")
lnParent_id = loJResp.IntOf("parent_id")
lcPurchase_note = loJResp.StringOf("purchase_note")
lnMenu_order = loJResp.IntOf("menu_order")
i = 0
lnCount_i = loJResp.SizeOfArray("downloads")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("related_ids")
DO WHILE i < lnCount_i
    loJResp.I = i
    lnIntVal = loJResp.IntOf("related_ids[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("upsell_ids")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("cross_sell_ids")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("categories")
DO WHILE i < lnCount_i
    loJResp.I = i
    lnId = loJResp.IntOf("categories[i].id")
    lcName = loJResp.StringOf("categories[i].name")
    lcSlug = loJResp.StringOf("categories[i].slug")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("tags")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("images")
DO WHILE i < lnCount_i
    loJResp.I = i
    lnId = loJResp.IntOf("images[i].id")
    loJResp.DtOf("images[i].date_created",0,loDate_created)
    loJResp.DtOf("images[i].date_created_gmt",0,loDate_created_gmt)
    loJResp.DtOf("images[i].date_modified",0,loDate_modified)
    loJResp.DtOf("images[i].date_modified_gmt",0,loDate_modified_gmt)
    lcSrc = loJResp.StringOf("images[i].src")
    lcName = loJResp.StringOf("images[i].name")
    lcAlt = loJResp.StringOf("images[i].alt")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("attributes")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("default_attributes")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("variations")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("grouped_products")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("meta_data")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("_links.self")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcHref = loJResp.StringOf("_links.self[i].href")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("_links.collection")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcHref = loJResp.StringOf("_links.collection[i].href")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
RELEASE loDate_created
RELEASE loDate_created_gmt
RELEASE loDate_modified
RELEASE loDate_modified_gmt
RELEASE loDate_on_sale_from
RELEASE loDate_on_sale_from_gmt
RELEASE loDate_on_sale_to
RELEASE loDate_on_sale_to_gmt


 

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