(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 <C_CkHttpW.h>
void ChilkatSample(void)
{
HCkHttpW http;
const wchar_t *jsonStr;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// Use your Shopify store's Admin API key and password.
CkHttpW_putLogin(http,L"admin_api_key");
CkHttpW_putPassword(http,L"admin_password");
CkHttpW_putBasicAuth(http,TRUE);
jsonStr = CkHttpW_quickGetStr(http,L"https://mystore.myshopify.com/admin/api/2020-07/products.json");
if (CkHttpW_getLastMethodSuccess(http) != TRUE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
return;
}
wprintf(L"Response status code: %d\n",CkHttpW_getLastStatus(http));
wprintf(L"JSON response:\n");
wprintf(L"%s\n",jsonStr);
CkHttpW_Dispose(http);
}
|