(Visual Basic 6.0) Shopify Receive Count of All Products in a Collection
Get a count of all products of a given collection
Dim rest As New ChilkatRest
Dim success As Long
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."
|