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

PowerBuilder 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

 

 

 

(PowerBuilder) 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

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
oleobject loo_Date_created
oleobject loo_Date_created_gmt
oleobject loo_Date_modified
oleobject loo_Date_modified_gmt
oleobject loo_Date_on_sale_from
oleobject loo_Date_on_sale_from_gmt
oleobject loo_Date_on_sale_to
oleobject loo_Date_on_sale_to_gmt
integer li_IntVal
string ls_Src
string ls_Alt
string ls_Href
integer li_Id
string ls_Name
string ls_Slug
string ls_Permalink
string ls_V_type
string ls_Status
integer li_Featured
string ls_Catalog_visibility
string ls_Description
string ls_Short_description
string ls_Sku
string ls_Price
string ls_Regular_price
string ls_Sale_price
string ls_Price_html
integer li_On_sale
integer li_Purchasable
integer li_Total_sales
integer li_Virtual
integer li_Downloadable
integer li_Download_limit
integer li_Download_expiry
string ls_External_url
string ls_Button_text
string ls_Tax_status
string ls_Tax_class
integer li_Manage_stock
string ls_Stock_quantity
string ls_Stock_status
string ls_Backorders
integer li_Backorders_allowed
integer li_Backordered
integer li_Sold_individually
string ls_Weight
string ls_DimensionsLength
string ls_DimensionsWidth
string ls_DimensionsHeight
integer li_Shipping_required
integer li_Shipping_taxable
string ls_Shipping_class
integer li_Shipping_class_id
integer li_Reviews_allowed
string ls_Average_rating
integer li_Rating_count
integer li_Parent_id
string ls_Purchase_note
integer li_Menu_order
integer i
integer li_Count_i

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

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

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

loo_Resp = loo_Http.QuickRequest("DELETE","https://example.com/wp-json/wc/v3/products/794?force=true")
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

destroy loo_Resp

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

loo_Date_created = create oleobject
// Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
li_rc = loo_Date_created.ConnectToNewObject("Chilkat.DtObj")

loo_Date_created_gmt = create oleobject
// Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
li_rc = loo_Date_created_gmt.ConnectToNewObject("Chilkat.DtObj")

loo_Date_modified = create oleobject
// Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
li_rc = loo_Date_modified.ConnectToNewObject("Chilkat.DtObj")

loo_Date_modified_gmt = create oleobject
// Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
li_rc = loo_Date_modified_gmt.ConnectToNewObject("Chilkat.DtObj")

loo_Date_on_sale_from = create oleobject
// Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
li_rc = loo_Date_on_sale_from.ConnectToNewObject("Chilkat.DtObj")

loo_Date_on_sale_from_gmt = create oleobject
// Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
li_rc = loo_Date_on_sale_from_gmt.ConnectToNewObject("Chilkat.DtObj")

loo_Date_on_sale_to = create oleobject
// Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
li_rc = loo_Date_on_sale_to.ConnectToNewObject("Chilkat.DtObj")

loo_Date_on_sale_to_gmt = create oleobject
// Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
li_rc = loo_Date_on_sale_to_gmt.ConnectToNewObject("Chilkat.DtObj")

li_Id = loo_JResp.IntOf("id")
ls_Name = loo_JResp.StringOf("name")
ls_Slug = loo_JResp.StringOf("slug")
ls_Permalink = loo_JResp.StringOf("permalink")
loo_JResp.DtOf("date_created",0,loo_Date_created)
loo_JResp.DtOf("date_created_gmt",0,loo_Date_created_gmt)
loo_JResp.DtOf("date_modified",0,loo_Date_modified)
loo_JResp.DtOf("date_modified_gmt",0,loo_Date_modified_gmt)
ls_V_type = loo_JResp.StringOf("type")
ls_Status = loo_JResp.StringOf("status")
li_Featured = loo_JResp.BoolOf("featured")
ls_Catalog_visibility = loo_JResp.StringOf("catalog_visibility")
ls_Description = loo_JResp.StringOf("description")
ls_Short_description = loo_JResp.StringOf("short_description")
ls_Sku = loo_JResp.StringOf("sku")
ls_Price = loo_JResp.StringOf("price")
ls_Regular_price = loo_JResp.StringOf("regular_price")
ls_Sale_price = loo_JResp.StringOf("sale_price")
loo_JResp.DtOf("date_on_sale_from",0,loo_Date_on_sale_from)
loo_JResp.DtOf("date_on_sale_from_gmt",0,loo_Date_on_sale_from_gmt)
loo_JResp.DtOf("date_on_sale_to",0,loo_Date_on_sale_to)
loo_JResp.DtOf("date_on_sale_to_gmt",0,loo_Date_on_sale_to_gmt)
ls_Price_html = loo_JResp.StringOf("price_html")
li_On_sale = loo_JResp.BoolOf("on_sale")
li_Purchasable = loo_JResp.BoolOf("purchasable")
li_Total_sales = loo_JResp.IntOf("total_sales")
li_Virtual = loo_JResp.BoolOf("virtual")
li_Downloadable = loo_JResp.BoolOf("downloadable")
li_Download_limit = loo_JResp.IntOf("download_limit")
li_Download_expiry = loo_JResp.IntOf("download_expiry")
ls_External_url = loo_JResp.StringOf("external_url")
ls_Button_text = loo_JResp.StringOf("button_text")
ls_Tax_status = loo_JResp.StringOf("tax_status")
ls_Tax_class = loo_JResp.StringOf("tax_class")
li_Manage_stock = loo_JResp.BoolOf("manage_stock")
ls_Stock_quantity = loo_JResp.StringOf("stock_quantity")
ls_Stock_status = loo_JResp.StringOf("stock_status")
ls_Backorders = loo_JResp.StringOf("backorders")
li_Backorders_allowed = loo_JResp.BoolOf("backorders_allowed")
li_Backordered = loo_JResp.BoolOf("backordered")
li_Sold_individually = loo_JResp.BoolOf("sold_individually")
ls_Weight = loo_JResp.StringOf("weight")
ls_DimensionsLength = loo_JResp.StringOf("dimensions.length")
ls_DimensionsWidth = loo_JResp.StringOf("dimensions.width")
ls_DimensionsHeight = loo_JResp.StringOf("dimensions.height")
li_Shipping_required = loo_JResp.BoolOf("shipping_required")
li_Shipping_taxable = loo_JResp.BoolOf("shipping_taxable")
ls_Shipping_class = loo_JResp.StringOf("shipping_class")
li_Shipping_class_id = loo_JResp.IntOf("shipping_class_id")
li_Reviews_allowed = loo_JResp.BoolOf("reviews_allowed")
ls_Average_rating = loo_JResp.StringOf("average_rating")
li_Rating_count = loo_JResp.IntOf("rating_count")
li_Parent_id = loo_JResp.IntOf("parent_id")
ls_Purchase_note = loo_JResp.StringOf("purchase_note")
li_Menu_order = loo_JResp.IntOf("menu_order")
i = 0
li_Count_i = loo_JResp.SizeOfArray("downloads")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("related_ids")
do while i < li_Count_i
    loo_JResp.I = i
    li_IntVal = loo_JResp.IntOf("related_ids[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("upsell_ids")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("cross_sell_ids")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("categories")
do while i < li_Count_i
    loo_JResp.I = i
    li_Id = loo_JResp.IntOf("categories[i].id")
    ls_Name = loo_JResp.StringOf("categories[i].name")
    ls_Slug = loo_JResp.StringOf("categories[i].slug")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("tags")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("images")
do while i < li_Count_i
    loo_JResp.I = i
    li_Id = loo_JResp.IntOf("images[i].id")
    loo_JResp.DtOf("images[i].date_created",0,loo_Date_created)
    loo_JResp.DtOf("images[i].date_created_gmt",0,loo_Date_created_gmt)
    loo_JResp.DtOf("images[i].date_modified",0,loo_Date_modified)
    loo_JResp.DtOf("images[i].date_modified_gmt",0,loo_Date_modified_gmt)
    ls_Src = loo_JResp.StringOf("images[i].src")
    ls_Name = loo_JResp.StringOf("images[i].name")
    ls_Alt = loo_JResp.StringOf("images[i].alt")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("attributes")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("default_attributes")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("variations")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("grouped_products")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("meta_data")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("_links.self")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Href = loo_JResp.StringOf("_links.self[i].href")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("_links.collection")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Href = loo_JResp.StringOf("_links.collection[i].href")
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
destroy loo_Date_created
destroy loo_Date_created_gmt
destroy loo_Date_modified
destroy loo_Date_modified_gmt
destroy loo_Date_on_sale_from
destroy loo_Date_on_sale_from_gmt
destroy loo_Date_on_sale_to
destroy loo_Date_on_sale_to_gmt

 

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