(Tcl) Shopify Basic Authentication: Get List of Products
Demonstrates how to send a simple HTTP GET request with Basic authentication to get a list of products.
load ./chilkat.dll
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# Use your Shopify store's Admin API key and password.
CkHttp_put_Login $http "admin_api_key"
CkHttp_put_Password $http "admin_password"
CkHttp_put_BasicAuth $http 1
set jsonStr [CkHttp_quickGetStr $http "https://mystore.myshopify.com/admin/api/2020-07/products.json"]
if {[CkHttp_get_LastMethodSuccess $http] != 1} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
exit
}
puts "Response status code: [CkHttp_get_LastStatus $http]"
puts "JSON response:"
puts "$jsonStr"
delete_CkHttp $http
|