Sample code for 30+ languages & platforms
C

Shopify Basic Authentication: Get List of Products

See more Shopify Examples

Demonstrates how to send a simple HTTP GET request with Basic authentication to get a list of products.

Chilkat C Downloads

C
#include <C_CkHttp.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    const char *jsonStr;

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http = CkHttp_Create();

    // Use your Shopify store's Admin API key and password.
    CkHttp_putLogin(http,"admin3_api_key");
    CkHttp_putPassword(http,"admin3_password");
    CkHttp_putBasicAuth(http,TRUE);

    jsonStr = CkHttp_quickGetStr(http,"https://mystore.myshopify.com/admin/api/2020-07/products.json");
    if (CkHttp_getLastMethodSuccess(http) != TRUE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        return;
    }

    printf("Response status code: %d\n",CkHttp_getLastStatus(http));
    printf("JSON response:\n");
    printf("%s\n",jsonStr);


    CkHttp_Dispose(http);

    }