Tcl
Tcl
Woo Commerce Authenticate with Query Params
See more WooCommerce Examples
Demonstrates how to authenticate with Woo Commerce over HTTPS using query params instead of HTTP Basic Authentication.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# To authentication over HTTPS using query params, put the query params in the URL.
set sbResponseBody [new_CkStringBuilder]
set success [CkHttp_QuickGetSb $http "https://example.com/wp-json/wc/v3/products?consumer_key=ck_52bf39999999999999999999999999999996da4d&consumer_secret=cs_6e8bb99999999999999999999999999999997054" $sbResponseBody]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody
exit
}
puts "Response Body:"
puts [CkStringBuilder_getAsString $sbResponseBody]
set respStatusCode [CkHttp_get_LastStatus $http]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
puts "Response Header:"
puts [CkHttp_lastHeader $http]
puts "Failed."
delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody
exit
}
delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody