Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Unicode C Web API Examples

Primary Categories

ABN AMRO
AWS Translate
Activix CRM
Adyen
Amazon DynamoDB
Amazon MWS
Amazon Rekognition
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
ETrade
Egypt ITIDA
Etsy
Facebook
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
MedTunnel
MercadoLibre

Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Okta OAuth/OIDC
OneLogin OIDC
OneNote
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yousign
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Unicode C) Shopify List Products

Receive a list of all Products

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Win Mobile 5.0/Pocket PC 2003

Solaris C/C++

FreeBSD C/C++

OpenBSD C/C++

MinGW C/C++

#include <C_CkRestW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkJsonObjectW.h>

void ChilkatSample(void)
    {
    HCkRestW rest;
    BOOL success;
    HCkStringBuilderW sbJson;
    HCkJsonObjectW json;
    int i;
    int count_i;
    int id;
    const wchar_t *title;
    const wchar_t *body_html;
    const wchar_t *vendor;
    const wchar_t *product_type;
    const wchar_t *created_at;
    const wchar_t *handle;
    const wchar_t *updated_at;
    const wchar_t *published_at;
    BOOL template_suffix;
    const wchar_t *published_scope;
    const wchar_t *tags;
    int imageId;
    int imageProduct_id;
    int imagePosition;
    const wchar_t *imageCreated_at;
    const wchar_t *imageUpdated_at;
    int imageWidth;
    int imageHeight;
    const wchar_t *imageSrc;
    BOOL image;
    int j;
    int count_j;
    int product_id;
    const wchar_t *price;
    const wchar_t *sku;
    int position;
    int grams;
    const wchar_t *inventory_policy;
    BOOL compare_at_price;
    const wchar_t *fulfillment_service;
    const wchar_t *inventory_management;
    const wchar_t *option1;
    BOOL option2;
    BOOL option3;
    BOOL taxable;
    const wchar_t *barcode;
    int image_id;
    int inventory_quantity;
    int weight;
    const wchar_t *weight_unit;
    int old_inventory_quantity;
    BOOL requires_shipping;
    const wchar_t *name;
    int k;
    int count_k;
    const wchar_t *strVal;
    int width;
    int height;
    const wchar_t *src;
    int intVal;

    rest = CkRestW_Create();

    CkRestW_SetAuthBasic(rest,L"SHOPIFY_PRIVATE_API_KEY",L"SHOPIFY_PRIVATE_API_SECRET_KEY");

    success = CkRestW_Connect(rest,L"chilkat.myshopify.com",443,TRUE,TRUE);
    if (success != TRUE) {
        wprintf(L"%s\n",CkRestW_lastErrorText(rest));
        CkRestW_Dispose(rest);
        return;
    }

    sbJson = CkStringBuilderW_Create();
    success = CkRestW_FullRequestNoBodySb(rest,L"GET",L"/admin/products.json",sbJson);
    if (success != TRUE) {
        wprintf(L"%s\n",CkRestW_lastErrorText(rest));
        CkRestW_Dispose(rest);
        CkStringBuilderW_Dispose(sbJson);
        return;
    }

    if (CkRestW_getResponseStatusCode(rest) != 200) {
        wprintf(L"Received error response code: %d\n",CkRestW_getResponseStatusCode(rest));
        wprintf(L"Response body:\n");
        wprintf(L"%s\n",CkStringBuilderW_getAsString(sbJson));
        CkRestW_Dispose(rest);
        CkStringBuilderW_Dispose(sbJson);
        return;
    }

    json = CkJsonObjectW_Create();
    CkJsonObjectW_LoadSb(json,sbJson);

    // The following code parses the JSON response.
    // A sample JSON response is shown below the sample code.

    i = 0;
    count_i = CkJsonObjectW_SizeOfArray(json,L"products");
    while (i < count_i) {
        CkJsonObjectW_putI(json,i);
        id = CkJsonObjectW_IntOf(json,L"products[i].id");
        title = CkJsonObjectW_stringOf(json,L"products[i].title");
        body_html = CkJsonObjectW_stringOf(json,L"products[i].body_html");
        vendor = CkJsonObjectW_stringOf(json,L"products[i].vendor");
        product_type = CkJsonObjectW_stringOf(json,L"products[i].product_type");
        created_at = CkJsonObjectW_stringOf(json,L"products[i].created_at");
        handle = CkJsonObjectW_stringOf(json,L"products[i].handle");
        updated_at = CkJsonObjectW_stringOf(json,L"products[i].updated_at");
        published_at = CkJsonObjectW_stringOf(json,L"products[i].published_at");
        template_suffix = CkJsonObjectW_IsNullOf(json,L"products[i].template_suffix");
        published_scope = CkJsonObjectW_stringOf(json,L"products[i].published_scope");
        tags = CkJsonObjectW_stringOf(json,L"products[i].tags");
        imageId = CkJsonObjectW_IntOf(json,L"products[i].image.id");
        imageProduct_id = CkJsonObjectW_IntOf(json,L"products[i].image.product_id");
        imagePosition = CkJsonObjectW_IntOf(json,L"products[i].image.position");
        imageCreated_at = CkJsonObjectW_stringOf(json,L"products[i].image.created_at");
        imageUpdated_at = CkJsonObjectW_stringOf(json,L"products[i].image.updated_at");
        imageWidth = CkJsonObjectW_IntOf(json,L"products[i].image.width");
        imageHeight = CkJsonObjectW_IntOf(json,L"products[i].image.height");
        imageSrc = CkJsonObjectW_stringOf(json,L"products[i].image.src");
        image = CkJsonObjectW_IsNullOf(json,L"products[i].image");
        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(json,L"products[i].variants");
        while (j < count_j) {
            CkJsonObjectW_putJ(json,j);
            id = CkJsonObjectW_IntOf(json,L"products[i].variants[j].id");
            product_id = CkJsonObjectW_IntOf(json,L"products[i].variants[j].product_id");
            title = CkJsonObjectW_stringOf(json,L"products[i].variants[j].title");
            price = CkJsonObjectW_stringOf(json,L"products[i].variants[j].price");
            sku = CkJsonObjectW_stringOf(json,L"products[i].variants[j].sku");
            position = CkJsonObjectW_IntOf(json,L"products[i].variants[j].position");
            grams = CkJsonObjectW_IntOf(json,L"products[i].variants[j].grams");
            inventory_policy = CkJsonObjectW_stringOf(json,L"products[i].variants[j].inventory_policy");
            compare_at_price = CkJsonObjectW_IsNullOf(json,L"products[i].variants[j].compare_at_price");
            fulfillment_service = CkJsonObjectW_stringOf(json,L"products[i].variants[j].fulfillment_service");
            inventory_management = CkJsonObjectW_stringOf(json,L"products[i].variants[j].inventory_management");
            option1 = CkJsonObjectW_stringOf(json,L"products[i].variants[j].option1");
            option2 = CkJsonObjectW_IsNullOf(json,L"products[i].variants[j].option2");
            option3 = CkJsonObjectW_IsNullOf(json,L"products[i].variants[j].option3");
            created_at = CkJsonObjectW_stringOf(json,L"products[i].variants[j].created_at");
            updated_at = CkJsonObjectW_stringOf(json,L"products[i].variants[j].updated_at");
            taxable = CkJsonObjectW_BoolOf(json,L"products[i].variants[j].taxable");
            barcode = CkJsonObjectW_stringOf(json,L"products[i].variants[j].barcode");
            image_id = CkJsonObjectW_IntOf(json,L"products[i].variants[j].image_id");
            inventory_quantity = CkJsonObjectW_IntOf(json,L"products[i].variants[j].inventory_quantity");
            weight = CkJsonObjectW_IntOf(json,L"products[i].variants[j].weight");
            weight_unit = CkJsonObjectW_stringOf(json,L"products[i].variants[j].weight_unit");
            old_inventory_quantity = CkJsonObjectW_IntOf(json,L"products[i].variants[j].old_inventory_quantity");
            requires_shipping = CkJsonObjectW_BoolOf(json,L"products[i].variants[j].requires_shipping");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(json,L"products[i].options");
        while (j < count_j) {
            CkJsonObjectW_putJ(json,j);
            id = CkJsonObjectW_IntOf(json,L"products[i].options[j].id");
            product_id = CkJsonObjectW_IntOf(json,L"products[i].options[j].product_id");
            name = CkJsonObjectW_stringOf(json,L"products[i].options[j].name");
            position = CkJsonObjectW_IntOf(json,L"products[i].options[j].position");
            k = 0;
            count_k = CkJsonObjectW_SizeOfArray(json,L"products[i].options[j].values");
            while (k < count_k) {
                CkJsonObjectW_putK(json,k);
                strVal = CkJsonObjectW_stringOf(json,L"products[i].options[j].values[k]");
                k = k + 1;
            }

            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(json,L"products[i].images");
        while (j < count_j) {
            CkJsonObjectW_putJ(json,j);
            id = CkJsonObjectW_IntOf(json,L"products[i].images[j].id");
            product_id = CkJsonObjectW_IntOf(json,L"products[i].images[j].product_id");
            position = CkJsonObjectW_IntOf(json,L"products[i].images[j].position");
            created_at = CkJsonObjectW_stringOf(json,L"products[i].images[j].created_at");
            updated_at = CkJsonObjectW_stringOf(json,L"products[i].images[j].updated_at");
            width = CkJsonObjectW_IntOf(json,L"products[i].images[j].width");
            height = CkJsonObjectW_IntOf(json,L"products[i].images[j].height");
            src = CkJsonObjectW_stringOf(json,L"products[i].images[j].src");
            k = 0;
            count_k = CkJsonObjectW_SizeOfArray(json,L"products[i].images[j].variant_ids");
            while (k < count_k) {
                CkJsonObjectW_putK(json,k);
                intVal = CkJsonObjectW_IntOf(json,L"products[i].images[j].variant_ids[k]");
                k = k + 1;
            }

            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(json,L"products[i].image.variant_ids");
        while (j < count_j) {
            CkJsonObjectW_putJ(json,j);
            j = j + 1;
        }

        i = i + 1;
    }

    // A sample JSON response body that is parsed by the above code:

    // {
    //   "products": [
    //     {
    //       "id": 632910392,
    //       "title": "IPod Nano - 8GB",
    //       "body_html": "<p>It's the small iPod with one very big idea: Video. Now the world's most popular music player, available in 4GB and 8GB models, lets you enjoy TV shows, movies, video podcasts, and more. The larger, brighter display means amazing picture quality. In six eye-catching colors, iPod nano is stunning all around. And with models starting at just $149, little speaks volumes.<\/p>",
    //       "vendor": "Apple",
    //       "product_type": "Cult Products",
    //       "created_at": "2017-09-22T14:08:02-04:00",
    //       "handle": "ipod-nano",
    //       "updated_at": "2017-09-22T14:08:02-04:00",
    //       "published_at": "2007-12-31T19:00:00-05:00",
    //       "template_suffix": null,
    //       "published_scope": "web",
    //       "tags": "Emotive, Flash Memory, MP3, Music",
    //       "variants": [
    //         {
    //           "id": 808950810,
    //           "product_id": 632910392,
    //           "title": "Pink",
    //           "price": "199.00",
    //           "sku": "IPOD2008PINK",
    //           "position": 1,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Pink",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_pink",
    //           "image_id": 562641783,
    //           "inventory_quantity": 10,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 10,
    //           "requires_shipping": true
    //         },
    //         {
    //           "id": 49148385,
    //           "product_id": 632910392,
    //           "title": "Red",
    //           "price": "199.00",
    //           "sku": "IPOD2008RED",
    //           "position": 2,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Red",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_red",
    //           "image_id": null,
    //           "inventory_quantity": 20,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 20,
    //           "requires_shipping": true
    //         },
    //         {
    //           "id": 39072856,
    //           "product_id": 632910392,
    //           "title": "Green",
    //           "price": "199.00",
    //           "sku": "IPOD2008GREEN",
    //           "position": 3,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Green",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_green",
    //           "image_id": null,
    //           "inventory_quantity": 30,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 30,
    //           "requires_shipping": true
    //         },
    //         {
    //           "id": 457924702,
    //           "product_id": 632910392,
    //           "title": "Black",
    //           "price": "199.00",
    //           "sku": "IPOD2008BLACK",
    //           "position": 4,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Black",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_black",
    //           "image_id": null,
    //           "inventory_quantity": 40,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 40,
    //           "requires_shipping": true
    //         }
    //       ],
    //       "options": [
    //         {
    //           "id": 594680422,
    //           "product_id": 632910392,
    //           "name": "Color",
    //           "position": 1,
    //           "values": [
    //             "Pink",
    //             "Red",
    //             "Green",
    //             "Black"
    //           ]
    //         }
    //       ],
    //       "images": [
    //         {
    //           "id": 850703190,
    //           "product_id": 632910392,
    //           "position": 1,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "width": 123,
    //           "height": 456,
    //           "src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano.png?v=1506103682",
    //           "variant_ids": [
    //           ]
    //         },
    //         {
    //           "id": 562641783,
    //           "product_id": 632910392,
    //           "position": 2,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "width": 123,
    //           "height": 456,
    //           "src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano-2.png?v=1506103682",
    //           "variant_ids": [
    //             808950810
    //           ]
    //         }
    //       ],
    //       "image": {
    //         "id": 850703190,
    //         "product_id": 632910392,
    //         "position": 1,
    //         "created_at": "2017-09-22T14:08:02-04:00",
    //         "updated_at": "2017-09-22T14:08:02-04:00",
    //         "width": 123,
    //         "height": 456,
    //         "src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano.png?v=1506103682",
    //         "variant_ids": [
    //         ]
    //       }
    //     },
    //     {
    //       "id": 921728736,
    //       "title": "IPod Touch 8GB",
    //       "body_html": "<p>The iPod Touch has the iPhone's multi-touch interface, with a physical home button off the touch screen. The home screen has a list of buttons for the available applications.<\/p>",
    //       "vendor": "Apple",
    //       "product_type": "Cult Products",
    //       "created_at": "2017-09-22T14:08:02-04:00",
    //       "handle": "ipod-touch",
    //       "updated_at": "2017-09-22T14:08:02-04:00",
    //       "published_at": "2008-09-25T20:00:00-04:00",
    //       "template_suffix": null,
    //       "published_scope": "global",
    //       "tags": "",
    //       "variants": [
    //         {
    //           "id": 447654529,
    //           "product_id": 921728736,
    //           "title": "Black",
    //           "price": "199.00",
    //           "sku": "IPOD2009BLACK",
    //           "position": 1,
    //           "grams": 567,
    //           "inventory_policy": "continue",
    //           "compare_at_price": null,
    //           "fulfillment_service": "manual",
    //           "inventory_management": "shopify",
    //           "option1": "Black",
    //           "option2": null,
    //           "option3": null,
    //           "created_at": "2017-09-22T14:08:02-04:00",
    //           "updated_at": "2017-09-22T14:08:02-04:00",
    //           "taxable": true,
    //           "barcode": "1234_black",
    //           "image_id": null,
    //           "inventory_quantity": 13,
    //           "weight": 1.25,
    //           "weight_unit": "lb",
    //           "old_inventory_quantity": 13,
    //           "requires_shipping": true
    //         }
    //       ],
    //       "options": [
    //         {
    //           "id": 891236591,
    //           "product_id": 921728736,
    //           "name": "Title",
    //           "position": 1,
    //           "values": [
    //             "Black"
    //           ]
    //         }
    //       ],
    //       "images": [
    //       ],
    //       "image": null
    //     }
    //   ]
    // }

    wprintf(L"Example Completed.\n");


    CkRestW_Dispose(rest);
    CkStringBuilderW_Dispose(sbJson);
    CkJsonObjectW_Dispose(json);

    }

 

© 2000-2021 Chilkat Software, Inc. All Rights Reserved.