Sample code for 30+ languages & platforms
VB.NET

Shopify Receive Count of All Products in a Collection

See more Shopify Examples

Get a count of all products of a given collection

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim rest As New Chilkat.Rest

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

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


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


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


Dim json As New Chilkat.JsonObject
json.LoadSb(sbJson)

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

count = json.IntOf("count")

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

' {
'   "count": 1
' }

Debug.WriteLine("Example Completed.")