|  | 
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  Node.js  Objective-C  PHP Extension  Perl  PowerBuilder  PowerShell  PureBasic  Ruby  SQL Server  Swift  Tcl  Unicode C  Unicode C++  VB.NET  VBScript  Visual Basic 6.0  Visual FoxPro  Xojo Plugin
| (Unicode C) Shopify Receive Count of All Products in a CollectionGet a count of all products of a given collection 
 #include <C_CkRestW.h> #include <C_CkStringBuilderW.h> #include <C_CkJsonObjectW.h> void ChilkatSample(void) { HCkRestW rest; BOOL success; HCkStringBuilderW sbJson; HCkJsonObjectW json; int count; rest = CkRestW_Create(); CkRestW_SetAuthBasic(rest,L"SHOPIFY_PRIVATE_API_KEY",L"SHOPIFY_PRIVATE_API_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/count.json?collection_id=841564295 ",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. count = CkJsonObjectW_IntOf(json,L"count"); // A sample JSON response body that is parsed by the above code: // { // "count": 1 // } wprintf(L"Example Completed.\n"); CkRestW_Dispose(rest); CkStringBuilderW_Dispose(sbJson); CkJsonObjectW_Dispose(json); } | ||||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.