(AutoIt) Shopify Receive Count of All Products in a Collection
Get a count of all products of a given collection
$oRest = ObjCreate("Chilkat.Rest")
Local $bSuccess
$oRest.SetAuthBasic("SHOPIFY_PRIVATE_API_KEY","SHOPIFY_PRIVATE_API_KEY")
$bSuccess = $oRest.Connect("chilkat.myshopify.com",443,True,True)
If ($bSuccess <> True) Then
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
$oSbJson = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/admin/products/count.json?collection_id=841564295 ",$oSbJson)
If ($bSuccess <> True) Then
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
If ($oRest.ResponseStatusCode <> 200) Then
ConsoleWrite("Received error response code: " & $oRest.ResponseStatusCode & @CRLF)
ConsoleWrite("Response body:" & @CRLF)
ConsoleWrite($oSbJson.GetAsString() & @CRLF)
Exit
EndIf
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.LoadSb($oSbJson)
; The following code parses the JSON response.
; A sample JSON response is shown below the sample code.
Local $iCount
$iCount = $oJson.IntOf("count")
; A sample JSON response body that is parsed by the above code:
; {
; "count": 1
; }
ConsoleWrite("Example Completed." & @CRLF)
|