(Tcl) Shopware Digest Authentication
Demonstrates using Digest access authentication for Shopware. For more information, see https://developers.shopware.com/developers-guide/rest-api/#digest-access-authentication
load ./chilkat.dll
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# To use HTTP Digest Authentication, set the login and password, and also indicate that DigestAuth should be used.
CkHttp_put_Login $http "api_username"
CkHttp_put_Password $http "api_key"
CkHttp_put_DigestAuth $http 1
set sbResponseBody [new_CkStringBuilder]
set success [CkHttp_QuickGetSb $http "https://my-shopware-shop.com/api/articles?limit=2" $sbResponseBody]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody
exit
}
set jResp [new_CkJsonObject]
CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0
puts "Response Body:"
puts [CkJsonObject_emit $jResp]
delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp
|