Sample code for 30+ languages & platforms
Visual Basic 6.0

Shopify Receive Count of All Products in a Collection

See more Shopify Examples

Get a count of all products of a given collection

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim rest As New ChilkatRest

success = rest.SetAuthBasic("SHOPIFY_PRIVATE_API_KEY","SHOPIFY_PRIVATE_API_KEY")

success = rest.Connect("chilkat.myshopify.com",443,1,1)
If (success <> 1) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

Dim sbJson As New ChilkatStringBuilder
success = rest.FullRequestNoBodySb("GET","/admin/products/count.json?collection_id=841564295 ",sbJson)
If (success <> 1) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

If (rest.ResponseStatusCode <> 200) Then
    Debug.Print "Received error response code: " & rest.ResponseStatusCode
    Debug.Print "Response body:"
    Debug.Print sbJson.GetAsString()
    Exit Sub
End If

Dim json As New ChilkatJsonObject
success = json.LoadSb(sbJson)

' The following code parses the JSON response.
' A sample JSON response is shown below the sample code.
Dim count As Long

count = json.IntOf("count")

' A sample JSON response body that is parsed by the above code:

' {
'   "count": 1
' }

Debug.Print "Example Completed."