Chilkat Examples

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

VB.NET Web API Examples

Primary Categories

ABN AMRO
AWS Translate
Activix CRM
Adyen
Amazon DynamoDB
Amazon MWS
Amazon Rekognition
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
ETrade
Egypt ITIDA
Etsy
Facebook
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
MercadoLibre

Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Okta OAuth/OIDC
OneLogin OIDC
OneNote
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
Trello
Twilio
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yousign
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(VB.NET) WiX Create Product

Creates a new product.

Note: If you get a 403 error response, try refreshing the access token.

For more information, see https://dev.wix.com/api/rest/wix-stores/catalog/product/create-product

Chilkat .NET Downloads

Chilkat .NET Assemblies

Chilkat for .NET Core

Chilkat for Mono

' 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 POST \
'    'https://www.wixapis.com/stores/v1/products' \
'     --data-binary '{
'                      "product": {
'                        "name": "T-shirt",
'                        "productType": "physical",
'                        "priceData": {
'                          "price": 10.5
'                        },
'                        "description": "nice summer t-shirt",
'                        "sku": "123df",
'                        "visible": false,
'                        "weight": 0.2,
'                        "discount": {
'                        	"type": "AMOUNT",
'                        	"value": 1
'                        },
'                        "manageVariants": true,
'                        "productOptions": [
'                          {
'                            "name": "Size",
'                            "choices": [
'                              {
'                                "value": "S",
'                                "description": "S"
'                              },
'                              {
'                                "value": "L",
'                                "description": "L"
'                              }
'                            ]
'                          }
'                        ]
'                      }
'                    }' \
'    -H 'Content-Type: application/json' \
'    -H 'Authorization: <AUTH>'

' Use the following online tool to generate HTTP code from a CURL command
' Convert a cURL Command to HTTP Source Code

' Use this online tool to generate code from sample JSON:
' Generate Code to Create JSON

' The following JSON is sent in the request body.

' {
'   "product": {
'     "name": "T-shirt",
'     "productType": "physical",
'     "priceData": {
'       "price": 10.5
'     },
'     "description": "nice summer t-shirt",
'     "sku": "123df",
'     "visible": false,
'     "weight": 0.2,
'     "discount": {
'       "type": "AMOUNT",
'       "value": 1
'     },
'     "manageVariants": true,
'     "productOptions": [
'       {
'         "name": "Size",
'         "choices": [
'           {
'             "value": "S",
'             "description": "S"
'           },
'           {
'             "value": "L",
'             "description": "L"
'           }
'         ]
'       }
'     ]
'   }
' }

Dim json As New Chilkat.JsonObject
json.UpdateString("product.name","T-shirt")
json.UpdateString("product.productType","physical")
json.UpdateNumber("product.priceData.price","10.5")
json.UpdateString("product.description","nice summer t-shirt")
json.UpdateString("product.sku","123df")
json.UpdateBool("product.visible",False)
json.UpdateNumber("product.weight","0.2")
json.UpdateString("product.discount.type","AMOUNT")
json.UpdateInt("product.discount.value",1)
json.UpdateBool("product.manageVariants",True)
json.UpdateString("product.productOptions[0].name","Size")
json.UpdateString("product.productOptions[0].choices[0].value","S")
json.UpdateString("product.productOptions[0].choices[0].description","S")
json.UpdateString("product.productOptions[0].choices[1].value","L")
json.UpdateString("product.productOptions[0].choices[1].description","L")

http.AuthToken = "ACCESS_TOKEN"
http.SetRequestHeader("Content-Type","application/json")

Dim resp As Chilkat.HttpResponse = http.PostJson3("https://www.wixapis.com/stores/v1/products","application/json",json)
If (http.LastMethodSuccess = False) Then
    Debug.WriteLine(http.LastErrorText)
    Exit Sub
End If


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

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

Dim respStatusCode As Integer = resp.StatusCode
Debug.WriteLine("Response Status Code = " & respStatusCode)
If (respStatusCode >= 400) Then
    Debug.WriteLine("Response Header:")
    Debug.WriteLine(resp.Header)
    Debug.WriteLine("Failed.")

    Exit Sub
End If



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

' {
'   "product": {
'     "id": "e28e4ddd-6ed0-4098-a5e5-cf4bd9c4f7b5",
'     "name": "T-shirt",
'     "slug": "t-shirt-1",
'     "visible": false,
'     "productType": "physical",
'     "description": "nice summer t-shirt",
'     "stock": {
'       "trackInventory": false,
'       "inStock": true
'     },
'     "price": {
'       "currency": "ILS",
'       "price": 10.5,
'       "discountedPrice": 9.5,
'       "formatted": {
'         "price": "10.50",
'         "discountedPrice": "9.50"
'       }
'     },
'     "priceData": {
'       "currency": "ILS",
'       "price": 10.5,
'       "discountedPrice": 9.5,
'       "formatted": {
'         "price": "10.50",
'         "discountedPrice": "9.50"
'       }
'     },
'     "additionalInfoSections": [
'     ],
'     "ribbons": [
'     ],
'     "media": {
'       "items": [
'       ]
'     },
'     "customTextFields": [
'     ],
'     "manageVariants": true,
'     "productOptions": [
'       {
'         "optionType": "drop_down",
'         "name": "Size",
'         "choices": [
'           {
'             "value": "S",
'             "description": "S",
'             "inStock": true,
'             "visible": true
'           },
'           {
'             "value": "L",
'             "description": "L",
'             "inStock": true,
'             "visible": true
'           }
'         ]
'       }
'     ],
'     "productPageUrl": {
'       "base": "https://www.itsjusttooeasy123.com/",
'       "path": "/product-page/t-shirt-1"
'     },
'     "numericId": "1567588455405000",
'     "inventoryItemId": "1d71b222-912f-bf67-5a1a-30b4263b084a",
'     "discount": {
'       "type": "AMOUNT",
'       "value": 1
'     },
'     "collectionIds": [
'     ],
'     "variants": [
'       {
'         "id": "00000000-0000-0001-0005-93fc95e0514a",
'         "choices": {
'           "Size": "S"
'         },
'         "variant": {
'           "priceData": {
'             "currency": "ILS",
'             "price": 10.5,
'             "discountedPrice": 9.5,
'             "formatted": {
'               "price": "10.50",
'               "discountedPrice": "9.50"
'             }
'           },
'           "weight": 10,
'           "visible": true
'         }
'       },
'       {
'         "id": "00000000-0000-0002-0005-93fc95e0514a",
'         "choices": {
'           "Size": "L"
'         },
'         "variant": {
'           "priceData": {
'             "currency": "ILS",
'             "price": 10.5,
'             "discountedPrice": 9.5,
'             "formatted": {
'               "price": "10.50",
'               "discountedPrice": "9.50"
'             }
'           },
'           "visible": true
'         }
'       }
'     ]
'   }
' }

' 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 optionType As String
Dim name As String
Dim j As Integer
Dim count_j As Integer
Dim value As String
Dim description As String
Dim inStock As Boolean
Dim visible As Boolean
Dim id As String
Dim choicesSize As String
Dim variantPriceDataCurrency As String
Dim variantPriceDataPrice As String
Dim variantPriceDataDiscountedPrice As String
Dim variantPriceDataFormattedPrice As String
Dim variantPriceDataFormattedDiscountedPrice As String
Dim variantWeight As Integer
Dim variantVisible As Boolean

Dim productId As String = jResp.StringOf("product.id")
Dim productName As String = jResp.StringOf("product.name")
Dim productSlug As String = jResp.StringOf("product.slug")
Dim productVisible As Boolean = jResp.BoolOf("product.visible")
Dim productProductType As String = jResp.StringOf("product.productType")
Dim productDescription As String = jResp.StringOf("product.description")
Dim productStockTrackInventory As Boolean = jResp.BoolOf("product.stock.trackInventory")
Dim productStockInStock As Boolean = jResp.BoolOf("product.stock.inStock")
Dim productPriceCurrency As String = jResp.StringOf("product.price.currency")
Dim productPricePrice As String = jResp.StringOf("product.price.price")
Dim productPriceDiscountedPrice As String = jResp.StringOf("product.price.discountedPrice")
Dim productPriceFormattedPrice As String = jResp.StringOf("product.price.formatted.price")
Dim productPriceFormattedDiscountedPrice As String = jResp.StringOf("product.price.formatted.discountedPrice")
Dim productPriceDataCurrency As String = jResp.StringOf("product.priceData.currency")
Dim productPriceDataPrice As String = jResp.StringOf("product.priceData.price")
Dim productPriceDataDiscountedPrice As String = jResp.StringOf("product.priceData.discountedPrice")
Dim productPriceDataFormattedPrice As String = jResp.StringOf("product.priceData.formatted.price")
Dim productPriceDataFormattedDiscountedPrice As String = jResp.StringOf("product.priceData.formatted.discountedPrice")
Dim productManageVariants As Boolean = jResp.BoolOf("product.manageVariants")
Dim productProductPageUrlBase As String = jResp.StringOf("product.productPageUrl.base")
Dim productProductPageUrlPath As String = jResp.StringOf("product.productPageUrl.path")
Dim productNumericId As String = jResp.StringOf("product.numericId")
Dim productInventoryItemId As String = jResp.StringOf("product.inventoryItemId")
Dim productDiscountType As String = jResp.StringOf("product.discount.type")
Dim productDiscountValue As Integer = jResp.IntOf("product.discount.value")
Dim i As Integer = 0
Dim count_i As Integer = jResp.SizeOfArray("product.additionalInfoSections")
While i < count_i
    jResp.I = i
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("product.ribbons")
While i < count_i
    jResp.I = i
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("product.media.items")
While i < count_i
    jResp.I = i
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("product.customTextFields")
While i < count_i
    jResp.I = i
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("product.productOptions")
While i < count_i
    jResp.I = i
    optionType = jResp.StringOf("product.productOptions[i].optionType")
    name = jResp.StringOf("product.productOptions[i].name")
    j = 0
    count_j = jResp.SizeOfArray("product.productOptions[i].choices")
    While j < count_j
        jResp.J = j
        value = jResp.StringOf("product.productOptions[i].choices[j].value")
        description = jResp.StringOf("product.productOptions[i].choices[j].description")
        inStock = jResp.BoolOf("product.productOptions[i].choices[j].inStock")
        visible = jResp.BoolOf("product.productOptions[i].choices[j].visible")
        j = j + 1
    End While
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("product.collectionIds")
While i < count_i
    jResp.I = i
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("product.variants")
While i < count_i
    jResp.I = i
    id = jResp.StringOf("product.variants[i].id")
    choicesSize = jResp.StringOf("product.variants[i].choices.Size")
    variantPriceDataCurrency = jResp.StringOf("product.variants[i].variant.priceData.currency")
    variantPriceDataPrice = jResp.StringOf("product.variants[i].variant.priceData.price")
    variantPriceDataDiscountedPrice = jResp.StringOf("product.variants[i].variant.priceData.discountedPrice")
    variantPriceDataFormattedPrice = jResp.StringOf("product.variants[i].variant.priceData.formatted.price")
    variantPriceDataFormattedDiscountedPrice = jResp.StringOf("product.variants[i].variant.priceData.formatted.discountedPrice")
    variantWeight = jResp.IntOf("product.variants[i].variant.weight")
    variantVisible = jResp.BoolOf("product.variants[i].variant.visible")
    i = i + 1
End While

 

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