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) Lightspeed - Create a Product

Create a new product based on the given parameters.

For more information, see https://developers.lightspeedhq.com/ecom/endpoints/product/#post-create-a-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   -u API_KEY:API_SECRET \
'     -H "Content-Type: application/json" \
'     -X POST \
'     -d '{
'   "product": {
'     "visibility": "visible",
'     "data01": "",
'     "data02": "",
'     "data03": "",
'     "title": "Lookin Sharp T-Shirt",
'     "fulltitle": "Lookin Sharp T-Shirt",
'     "description": "Description of the Lookin Sharp T-Shirt",
'     "content": "Long Description of the Lookin Sharp T-Shirt",
'     "deliverydate": 6488,
'     "supplier": 78794,
'     "brand": 1171202
'   }
' }' \
' "https://api.webshopapp.com/en/products.json"

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

http.Login = "API_KEY"
http.Password = "API_SECRET"

' 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": {
'     "visibility": "visible",
'     "data01": "",
'     "data02": "",
'     "data03": "",
'     "title": "Lookin Sharp T-Shirt",
'     "fulltitle": "Lookin Sharp T-Shirt",
'     "description": "Description of the Lookin Sharp T-Shirt",
'     "content": "Long Description of the Lookin Sharp T-Shirt",
'     "deliverydate": 6488,
'     "supplier": 78794,
'     "brand": 1171202
'   }
' }

Dim json As New Chilkat.JsonObject
json.UpdateString("product.visibility","visible")
json.UpdateString("product.data01","")
json.UpdateString("product.data02","")
json.UpdateString("product.data03","")
json.UpdateString("product.title","Lookin Sharp T-Shirt")
json.UpdateString("product.fulltitle","Lookin Sharp T-Shirt")
json.UpdateString("product.description","Description of the Lookin Sharp T-Shirt")
json.UpdateString("product.content","Long Description of the Lookin Sharp T-Shirt")
json.UpdateInt("product.deliverydate",6488)
json.UpdateInt("product.supplier",78794)
json.UpdateInt("product.brand",1171202)

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

' Use the correct cluster for your shop.  Here are the choices:
' eu1 https://api.webshopapp.com/en/
' us1 https://api.shoplightspeed.com/en/
Dim resp As Chilkat.HttpResponse = http.PostJson3("https://api.webshopapp.com/en/products.json","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": 20974460,
'     "createdAt": "2019-05-28T20:14:26+00:00",
'     "updatedAt": "2019-05-28T20:14:26+00:00",
'     "isVisible": true,
'     "visibility": "visible",
'     "hasMatrix": false,
'     "data01": "",
'     "data02": "",
'     "data03": "",
'     "url": "lookin-sharp-t-shirt",
'     "title": "Lookin' Sharp T-Shirt",
'     "fulltitle": "Lookin' Sharp T-Shirt",
'     "description": "Description of the Lookin' Sharp T-Shirt",
'     "content": "<p>Long Description of the Lookin' Sharp T-Shirt</p>",
'     "set": false,
'     "brand": {
'       "resource": {
'         "id": 1171202,
'         "url": "brands/1171202",
'         "link": "https://api.shoplightspeed.com/us/brands/1171202.json"
'       }
'     },
'     "categories": {
'       "resource": {
'         "id": false,
'         "url": "categories/products?product=20974460",
'         "link": "https://api.shoplightspeed.com/us/categories/products.json?product=20974460"
'       }
'     },
'     "deliverydate": {
'       "resource": {
'         "id": 6488,
'         "url": "deliverydates/6488",
'         "link": "https://api.shoplightspeed.com/us/deliverydates/6488.json"
'       }
'     },
'     "image": false,
'     "images": false,
'     "relations": {
'       "resource": {
'         "id": false,
'         "url": "products/20974460/relations",
'         "link": "https://api.shoplightspeed.com/us/products/20974460/relations.json"
'       }
'     },
'     "metafields": {
'       "resource": {
'         "id": false,
'         "url": "products/20974460/metafields",
'         "link": "https://api.shoplightspeed.com/us/products/20974460/metafields.json"
'       }
'     },
'     "reviews": {
'       "resource": {
'         "id": false,
'         "url": "reviews?product=20974460",
'         "link": "https://api.shoplightspeed.com/us/reviews.json?product=20974460"
'       }
'     },
'     "type": false,
'     "attributes": {
'       "resource": {
'         "id": false,
'         "url": "products/20974460/attributes",
'         "link": "https://api.shoplightspeed.com/us/products/20974460/attributes.json"
'       }
'     },
'     "supplier": {
'       "resource": {
'         "id": 78794,
'         "url": "suppliers/78794",
'         "link": "https://api.shoplightspeed.com/us/suppliers/78794.json"
'       }
'     },
'     "tags": {
'       "resource": {
'         "id": false,
'         "url": "tags/products?product=20974460",
'         "link": "https://api.shoplightspeed.com/us/tags/products.json?product=20974460"
'       }
'     },
'     "variants": {
'       "resource": {
'         "id": false,
'         "url": "variants?product=20974460",
'         "link": "https://api.shoplightspeed.com/us/variants.json?product=20974460"
'       }
'     },
'     "movements": {
'       "resource": {
'         "id": false,
'         "url": "variants/movements?product=20974460",
'         "link": "https://api.shoplightspeed.com/us/variants/movements.json?product=20974460"
'       }
'     }
'   }
' }

' 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 productId As Integer = jResp.IntOf("product.id")
Dim productCreatedAt As String = jResp.StringOf("product.createdAt")
Dim productUpdatedAt As String = jResp.StringOf("product.updatedAt")
Dim productIsVisible As Boolean = jResp.BoolOf("product.isVisible")
Dim productVisibility As String = jResp.StringOf("product.visibility")
Dim productHasMatrix As Boolean = jResp.BoolOf("product.hasMatrix")
Dim productData01 As String = jResp.StringOf("product.data01")
Dim productData02 As String = jResp.StringOf("product.data02")
Dim productData03 As String = jResp.StringOf("product.data03")
Dim productUrl As String = jResp.StringOf("product.url")
Dim productTitle As String = jResp.StringOf("product.title")
Dim productFulltitle As String = jResp.StringOf("product.fulltitle")
Dim productDescription As String = jResp.StringOf("product.description")
Dim productContent As String = jResp.StringOf("product.content")
Dim productSet As Boolean = jResp.BoolOf("product.set")
Dim productBrandResourceId As Integer = jResp.IntOf("product.brand.resource.id")
Dim productBrandResourceUrl As String = jResp.StringOf("product.brand.resource.url")
Dim productBrandResourceLink As String = jResp.StringOf("product.brand.resource.link")
Dim productCategoriesResourceId As Boolean = jResp.BoolOf("product.categories.resource.id")
Dim productCategoriesResourceUrl As String = jResp.StringOf("product.categories.resource.url")
Dim productCategoriesResourceLink As String = jResp.StringOf("product.categories.resource.link")
Dim productDeliverydateResourceId As Integer = jResp.IntOf("product.deliverydate.resource.id")
Dim productDeliverydateResourceUrl As String = jResp.StringOf("product.deliverydate.resource.url")
Dim productDeliverydateResourceLink As String = jResp.StringOf("product.deliverydate.resource.link")
Dim productImage As Boolean = jResp.BoolOf("product.image")
Dim productImages As Boolean = jResp.BoolOf("product.images")
Dim productRelationsResourceId As Boolean = jResp.BoolOf("product.relations.resource.id")
Dim productRelationsResourceUrl As String = jResp.StringOf("product.relations.resource.url")
Dim productRelationsResourceLink As String = jResp.StringOf("product.relations.resource.link")
Dim productMetafieldsResourceId As Boolean = jResp.BoolOf("product.metafields.resource.id")
Dim productMetafieldsResourceUrl As String = jResp.StringOf("product.metafields.resource.url")
Dim productMetafieldsResourceLink As String = jResp.StringOf("product.metafields.resource.link")
Dim productReviewsResourceId As Boolean = jResp.BoolOf("product.reviews.resource.id")
Dim productReviewsResourceUrl As String = jResp.StringOf("product.reviews.resource.url")
Dim productReviewsResourceLink As String = jResp.StringOf("product.reviews.resource.link")
Dim productType As Boolean = jResp.BoolOf("product.type")
Dim productAttributesResourceId As Boolean = jResp.BoolOf("product.attributes.resource.id")
Dim productAttributesResourceUrl As String = jResp.StringOf("product.attributes.resource.url")
Dim productAttributesResourceLink As String = jResp.StringOf("product.attributes.resource.link")
Dim productSupplierResourceId As Integer = jResp.IntOf("product.supplier.resource.id")
Dim productSupplierResourceUrl As String = jResp.StringOf("product.supplier.resource.url")
Dim productSupplierResourceLink As String = jResp.StringOf("product.supplier.resource.link")
Dim productTagsResourceId As Boolean = jResp.BoolOf("product.tags.resource.id")
Dim productTagsResourceUrl As String = jResp.StringOf("product.tags.resource.url")
Dim productTagsResourceLink As String = jResp.StringOf("product.tags.resource.link")
Dim productVariantsResourceId As Boolean = jResp.BoolOf("product.variants.resource.id")
Dim productVariantsResourceUrl As String = jResp.StringOf("product.variants.resource.url")
Dim productVariantsResourceLink As String = jResp.StringOf("product.variants.resource.link")
Dim productMovementsResourceId As Boolean = jResp.BoolOf("product.movements.resource.id")
Dim productMovementsResourceUrl As String = jResp.StringOf("product.movements.resource.url")
Dim productMovementsResourceLink As String = jResp.StringOf("product.movements.resource.link")

 

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