Sample code for 30+ languages & platforms
AutoIt

Shopify Receive Count of All Products in a Collection

See more Shopify Examples

Get a count of all products of a given collection

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

$oRest = ObjCreate("Chilkat.Rest")

$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)