Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

C Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(C) WiX - Get all Products in a Store

Gets the first page of products in a store.

For more information, see https://dev.wix.com/api/rest/wix-stores/catalog/filter-and-sort

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++

Solaris C/C++

MinGW C/C++

#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>
#include <C_CkStringBuilder.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject json;
    HCkHttpResponse resp;
    HCkStringBuilder sbResponseBody;
    HCkJsonObject jResp;
    int respStatusCode;
    const char *id;
    const char *name;
    const char *slug;
    BOOL visible;
    const char *productType;
    const char *description;
    BOOL stockTrackInventory;
    int stockQuantity;
    BOOL stockInStock;
    const char *priceCurrency;
    int pricePrice;
    int priceDiscountedPrice;
    const char *priceFormattedPrice;
    const char *priceFormattedDiscountedPrice;
    const char *priceDataCurrency;
    int priceDataPrice;
    int priceDataDiscountedPrice;
    const char *priceDataFormattedPrice;
    const char *priceDataFormattedDiscountedPrice;
    BOOL manageVariants;
    const char *productPageUrlBase;
    const char *productPageUrlPath;
    const char *numericId;
    const char *inventoryItemId;
    const char *discountType;
    int discountValue;
    const char *sku;
    int weight;
    int j;
    int count_j;
    const char *text;
    const char *strVal;
    int metadataItems;
    int metadataOffset;
    int totalResults;
    int i;
    int count_i;

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

    http = CkHttp_Create();

    // Implements the following CURL command:

    // curl -X POST -H "Content-Type: application/json" \
    //    -d '{
    //   "includeVariants": true
    //   }' https://www.wixapis.com/stores/v1/products/query

    json = CkJsonObject_Create();
    CkJsonObject_UpdateBool(json,"includeVariants",TRUE);

    CkHttp_putAuthToken(http,"ACCESS_TOKEN");
    CkHttp_SetRequestHeader(http,"Content-Type","application/json");

    resp = CkHttp_PostJson3(http,"https://www.wixapis.com/stores/v1/products/query","application/json",json);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(json);
        return;
    }

    sbResponseBody = CkStringBuilder_Create();
    CkHttpResponse_GetBodySb(resp,sbResponseBody);
    jResp = CkJsonObject_Create();
    CkJsonObject_LoadSb(jResp,sbResponseBody);
    CkJsonObject_putEmitCompact(jResp,FALSE);

    printf("Response Body:\n");
    printf("%s\n",CkJsonObject_emit(jResp));

    respStatusCode = CkHttpResponse_getStatusCode(resp);
    printf("Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        printf("Response Header:\n");
        printf("%s\n",CkHttpResponse_header(resp));
        printf("Failed.\n");
        CkHttpResponse_Dispose(resp);
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(json);
        CkStringBuilder_Dispose(sbResponseBody);
        CkJsonObject_Dispose(jResp);
        return;
    }

    CkHttpResponse_Dispose(resp);

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "products": [
    //     {
    //       "id": "58fcbb51-ff87-08ff-d97b-646726676e4a",
    //       "name": "webhook test",
    //       "slug": "webhook-test",
    //       "visible": true,
    //       "productType": "physical",
    //       "description": "<p>fasdf<\/p>",
    //       "stock": {
    //         "trackInventory": true,
    //         "quantity": 0,
    //         "inStock": false
    //       },
    //       "price": {
    //         "currency": "ILS",
    //         "price": 234,
    //         "discountedPrice": 234,
    //         "formatted": {
    //           "price": "234.00 ",
    //           "discountedPrice": "234.00 "
    //         }
    //       },
    //       "priceData": {
    //         "currency": "ILS",
    //         "price": 234,
    //         "discountedPrice": 234,
    //         "formatted": {
    //           "price": "234.00 ",
    //           "discountedPrice": "234.00 "
    //         }
    //       },
    //       "additionalInfoSections": [
    //       ],
    //       "ribbons": [
    //         {
    //           "text": "ribby"
    //         }
    //       ],
    //       "media": {
    //         "items": [
    //         ]
    //       },
    //       "customTextFields": [
    //       ],
    //       "manageVariants": true,
    //       "productOptions": [
    //       ],
    //       "productPageUrl": {
    //         "base": "https://www.my-website.com/",
    //         "path": "/product-page/webhook-test"
    //       },
    //       "numericId": "1567078000586000",
    //       "inventoryItemId": "a70344ae-0078-f700-2684-9b98d99891b5",
    //       "discount": {
    //         "type": "NONE",
    //         "value": 0
    //       },
    //       "collectionIds": [
    //       ],
    //       "variants": [
    //       ]
    //     },
    //     {
    //       "id": "6507fd67-94e5-10af-73e4-d2167852d5bc",
    //       "name": "digital product",
    //       "slug": "digital-product",
    //       "visible": true,
    //       "productType": "digital",
    //       "description": "",
    //       "sku": "",
    //       "weight": 0,
    //       "stock": {
    //         "trackInventory": false,
    //         "inStock": true
    //       },
    //       "price": {
    //         "currency": "ILS",
    //         "price": 123,
    //         "discountedPrice": 123,
    //         "formatted": {
    //           "price": "123.00 ",
    //           "discountedPrice": "123.00 "
    //         }
    //       },
    //       "priceData": {
    //         "currency": "ILS",
    //         "price": 123,
    //         "discountedPrice": 123,
    //         "formatted": {
    //           "price": "123.00 ",
    //           "discountedPrice": "123.00 "
    //         }
    //       },
    //       "additionalInfoSections": [
    //       ],
    //       "ribbons": [
    //       ],
    //       "media": {
    //         "items": [
    //         ]
    //       },
    //       "customTextFields": [
    //       ],
    //       "manageVariants": false,
    //       "productOptions": [
    //       ],
    //       "productPageUrl": {
    //         "base": "https://www.my-website.com/",
    //         "path": "/product-page/digital-product"
    //       },
    //       "numericId": "1544009414325000",
    //       "inventoryItemId": "9af80298-6b1a-ef50-8c1b-2de987ad2a43",
    //       "discount": {
    //         "type": "NONE",
    //         "value": 0
    //       },
    //       "collectionIds": [
    //         "ae886d55-2572-eee8-b2c4-13219844b5e4"
    //       ],
    //       "variants": [
    //       ]
    //     }
    //   ],
    //   "metadata": {
    //     "items": 100,
    //     "offset": 0
    //   },
    //   "totalResults": 2
    // }

    // Sample code for parsing the JSON response...
    // Use the following online tool to generate parsing code from sample JSON:
    // Generate Parsing Code from JSON

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
    // See this example explaining how this memory should be used: const char * functions.

    metadataItems = CkJsonObject_IntOf(jResp,"metadata.items");
    metadataOffset = CkJsonObject_IntOf(jResp,"metadata.offset");
    totalResults = CkJsonObject_IntOf(jResp,"totalResults");
    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"products");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        id = CkJsonObject_stringOf(jResp,"products[i].id");
        name = CkJsonObject_stringOf(jResp,"products[i].name");
        slug = CkJsonObject_stringOf(jResp,"products[i].slug");
        visible = CkJsonObject_BoolOf(jResp,"products[i].visible");
        productType = CkJsonObject_stringOf(jResp,"products[i].productType");
        description = CkJsonObject_stringOf(jResp,"products[i].description");
        stockTrackInventory = CkJsonObject_BoolOf(jResp,"products[i].stock.trackInventory");
        stockQuantity = CkJsonObject_IntOf(jResp,"products[i].stock.quantity");
        stockInStock = CkJsonObject_BoolOf(jResp,"products[i].stock.inStock");
        priceCurrency = CkJsonObject_stringOf(jResp,"products[i].price.currency");
        pricePrice = CkJsonObject_IntOf(jResp,"products[i].price.price");
        priceDiscountedPrice = CkJsonObject_IntOf(jResp,"products[i].price.discountedPrice");
        priceFormattedPrice = CkJsonObject_stringOf(jResp,"products[i].price.formatted.price");
        priceFormattedDiscountedPrice = CkJsonObject_stringOf(jResp,"products[i].price.formatted.discountedPrice");
        priceDataCurrency = CkJsonObject_stringOf(jResp,"products[i].priceData.currency");
        priceDataPrice = CkJsonObject_IntOf(jResp,"products[i].priceData.price");
        priceDataDiscountedPrice = CkJsonObject_IntOf(jResp,"products[i].priceData.discountedPrice");
        priceDataFormattedPrice = CkJsonObject_stringOf(jResp,"products[i].priceData.formatted.price");
        priceDataFormattedDiscountedPrice = CkJsonObject_stringOf(jResp,"products[i].priceData.formatted.discountedPrice");
        manageVariants = CkJsonObject_BoolOf(jResp,"products[i].manageVariants");
        productPageUrlBase = CkJsonObject_stringOf(jResp,"products[i].productPageUrl.base");
        productPageUrlPath = CkJsonObject_stringOf(jResp,"products[i].productPageUrl.path");
        numericId = CkJsonObject_stringOf(jResp,"products[i].numericId");
        inventoryItemId = CkJsonObject_stringOf(jResp,"products[i].inventoryItemId");
        discountType = CkJsonObject_stringOf(jResp,"products[i].discount.type");
        discountValue = CkJsonObject_IntOf(jResp,"products[i].discount.value");
        sku = CkJsonObject_stringOf(jResp,"products[i].sku");
        weight = CkJsonObject_IntOf(jResp,"products[i].weight");
        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"products[i].additionalInfoSections");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"products[i].ribbons");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            text = CkJsonObject_stringOf(jResp,"products[i].ribbons[j].text");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"products[i].media.items");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"products[i].customTextFields");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"products[i].productOptions");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"products[i].collectionIds");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            strVal = CkJsonObject_stringOf(jResp,"products[i].collectionIds[j]");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObject_SizeOfArray(jResp,"products[i].variants");
        while (j < count_j) {
            CkJsonObject_putJ(jResp,j);
            j = j + 1;
        }

        i = i + 1;
    }



    CkHttp_Dispose(http);
    CkJsonObject_Dispose(json);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jResp);

    }

 

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