(Unicode C++) 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.
#include <CkHttpW.h>
void ChilkatSample(void)
{
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
// Use your Shopify store's Admin API key and password.
http.put_Login(L"admin_api_key");
http.put_Password(L"admin_password");
http.put_BasicAuth(true);
const wchar_t *jsonStr = http.quickGetStr(L"https://mystore.myshopify.com/admin/api/2020-07/products.json");
if (http.get_LastMethodSuccess() != true) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
wprintf(L"Response status code: %d\n",http.get_LastStatus());
wprintf(L"JSON response:\n");
wprintf(L"%s\n",jsonStr);
}
|