Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

VB.NET UWP/WinRT Web API Examples

Primary Categories

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shippo
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(VB.NET UWP/WinRT) Etsy: Get the Inventory for a Listing

Gets the inventory for a listing.

For more information, see https://www.etsy.com/developers/documentation/reference/listinginventory

Chilkat Universal Windows Platform (UWP) / WinRT Downloads

Chilkat for the Universal Windows Platform (UWP)

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim http As New Chilkat.Http
Dim success As Boolean

' Implements the following CURL command:

' curl -X GET \
'   https://openapi.etsy.com/v2/listings/listing_id/inventory?api_key=MY_ETSY_KEYSTRING


Dim sbResponseBody As New Chilkat.StringBuilder
success = Await http.QuickGetSbAsync("https://openapi.etsy.com/v2/listings/listing_id/inventory?api_key=MY_ETSY_KEYSTRING",sbResponseBody)
If (success = False) Then
    Debug.WriteLine(http.LastErrorText)
    Exit Sub
End If


Dim jResp As New Chilkat.JsonObject
jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = False

Debug.WriteLine("Response Body:")
Debug.WriteLine(jResp.Emit())

Dim respStatusCode As Integer = http.LastStatus
Debug.WriteLine("Response Status Code = " & respStatusCode)
If (respStatusCode >= 400) Then
    Debug.WriteLine("Response Header:")
    Debug.WriteLine(http.LastHeader)
    Debug.WriteLine("Failed.")
    Exit Sub
End If


' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)

' {
'   "count": 1,
'   "results": {
'     "products": [
'       {
'         "product_id": 3361120103,
'         "property_values": [
'         ],
'         "offerings": [
'           {
'             "offering_id": 3579642570,
'             "price": {
'               "amount": 16000,
'               "divisor": 100,
'               "currency_code": "USD",
'               "currency_formatted_short": "$160.00",
'               "currency_formatted_long": "$160.00 USD",
'               "currency_formatted_raw": "160.00"
'             },
'             "quantity": 1
'           }
'         ]
'       }
'     ]
'   },
'   "params": {
'     "listing_id": "720138253",
'     "write_missing_inventory": false
'   },
'   "type": "ListingInventory",
'   "pagination": {}
' }

' Sample code for parsing the JSON response...
' Use the following online tool to generate parsing code from sample JSON:
' Generate Parsing Code from JSON



Dim product_id As Integer
Dim j As Integer
Dim count_j As Integer
Dim offering_id As Integer
Dim priceAmount As Integer
Dim priceDivisor As Integer
Dim priceCurrency_code As String
Dim priceCurrency_formatted_short As String
Dim priceCurrency_formatted_long As String
Dim priceCurrency_formatted_raw As String
Dim quantity As Integer

Dim count As Integer = jResp.IntOf("count")
Dim paramsListing_id As String = jResp.StringOf("params.listing_id")
Dim paramsWrite_missing_inventory As Boolean = jResp.BoolOf("params.write_missing_inventory")
Dim v_type As String = jResp.StringOf("type")
Dim i As Integer = 0
Dim count_i As Integer = jResp.SizeOfArray("results.products")
While i < count_i
    jResp.I = i
    product_id = jResp.IntOf("results.products[i].product_id")
    j = 0
    count_j = jResp.SizeOfArray("results.products[i].property_values")
    While j < count_j
        jResp.J = j
        j = j + 1
    End While
    j = 0
    count_j = jResp.SizeOfArray("results.products[i].offerings")
    While j < count_j
        jResp.J = j
        offering_id = jResp.IntOf("results.products[i].offerings[j].offering_id")
        priceAmount = jResp.IntOf("results.products[i].offerings[j].price.amount")
        priceDivisor = jResp.IntOf("results.products[i].offerings[j].price.divisor")
        priceCurrency_code = jResp.StringOf("results.products[i].offerings[j].price.currency_code")
        priceCurrency_formatted_short = jResp.StringOf("results.products[i].offerings[j].price.currency_formatted_short")
        priceCurrency_formatted_long = jResp.StringOf("results.products[i].offerings[j].price.currency_formatted_long")
        priceCurrency_formatted_raw = jResp.StringOf("results.products[i].offerings[j].price.currency_formatted_raw")
        quantity = jResp.IntOf("results.products[i].offerings[j].quantity")
        j = j + 1
    End While
    i = i + 1
End While

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.