|  | 
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
| (C) Shopify Receive Count of All Products in a CollectionGet a count of all products of a given collection 
 #include <C_CkRest.h> #include <C_CkStringBuilder.h> #include <C_CkJsonObject.h> void ChilkatSample(void) { HCkRest rest; BOOL success; HCkStringBuilder sbJson; HCkJsonObject json; int count; rest = CkRest_Create(); CkRest_SetAuthBasic(rest,"SHOPIFY_PRIVATE_API_KEY","SHOPIFY_PRIVATE_API_KEY"); success = CkRest_Connect(rest,"chilkat.myshopify.com",443,TRUE,TRUE); if (success != TRUE) { printf("%s\n",CkRest_lastErrorText(rest)); CkRest_Dispose(rest); return; } sbJson = CkStringBuilder_Create(); success = CkRest_FullRequestNoBodySb(rest,"GET","/admin/products/count.json?collection_id=841564295 ",sbJson); if (success != TRUE) { printf("%s\n",CkRest_lastErrorText(rest)); CkRest_Dispose(rest); CkStringBuilder_Dispose(sbJson); return; } if (CkRest_getResponseStatusCode(rest) != 200) { printf("Received error response code: %d\n",CkRest_getResponseStatusCode(rest)); printf("Response body:\n"); printf("%s\n",CkStringBuilder_getAsString(sbJson)); CkRest_Dispose(rest); CkStringBuilder_Dispose(sbJson); return; } json = CkJsonObject_Create(); CkJsonObject_LoadSb(json,sbJson); // The following code parses the JSON response. // A sample JSON response is shown below the sample code. count = CkJsonObject_IntOf(json,"count"); // A sample JSON response body that is parsed by the above code: // { // "count": 1 // } printf("Example Completed.\n"); CkRest_Dispose(rest); CkStringBuilder_Dispose(sbJson); CkJsonObject_Dispose(json); } | ||||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.