Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

VB.NET Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
Mastercard

MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(VB.NET) Shippo Create Customs Declaration

Demonstrates how to create a customs declaration and send a POST request with the necessary information to the Customs Declarations endpoint.

For more information, see https://goshippo.com/docs/international/

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 https://api.goshippo.com/customs/declarations/ \
'     -H "Authorization: ShippoToken <API_TOKEN>" \
'     -H "Content-Type: application/json"  \
'     -d '{          
'           "contents_type": "MERCHANDISE",
'           "non_delivery_option": "RETURN",
'           "certify": true,
'           "certify_signer": "Simon Kreuz",
'           "incoterm": "DDU",
'           "items": [{
'                     "description": "T-shirt",
'                     "quantity": 20,
'                     "net_weight": "5",
'                     "mass_unit": "lb",
'                     "value_amount": "200",
'                     "value_currency": "USD",
'                     "tariff_number": "",
'                     "origin_country": "US"
'             }]
'     }'

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

' The following JSON is sent in the request body.

' {
'   "contents_type": "MERCHANDISE",
'   "non_delivery_option": "RETURN",
'   "certify": true,
'   "certify_signer": "Simon Kreuz",
'   "incoterm": "DDU",
'   "items": [
'     {
'       "description": "T-shirt",
'       "quantity": 20,
'       "net_weight": "5",
'       "mass_unit": "lb",
'       "value_amount": "200",
'       "value_currency": "USD",
'       "tariff_number": "",
'       "origin_country": "US"
'     }
'   ]
' }

Dim json As New Chilkat.JsonObject
json.UpdateString("contents_type","MERCHANDISE")
json.UpdateString("non_delivery_option","RETURN")
json.UpdateBool("certify",True)
json.UpdateString("certify_signer","Simon Kreuz")
json.UpdateString("incoterm","DDU")
json.UpdateString("items[0].description","T-shirt")
json.UpdateInt("items[0].quantity",20)
json.UpdateString("items[0].net_weight","5")
json.UpdateString("items[0].mass_unit","lb")
json.UpdateString("items[0].value_amount","200")
json.UpdateString("items[0].value_currency","USD")
json.UpdateString("items[0].tariff_number","")
json.UpdateString("items[0].origin_country","US")

http.SetRequestHeader("Authorization","ShippoToken <API_TOKEN>")
http.SetRequestHeader("Content-Type","application/json")

Dim resp As Chilkat.HttpResponse = http.PostJson3("https://api.goshippo.com/customs/declarations/","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)

' {
'   "object_created": "2019-07-04T16:00:29.043Z",
'   "object_updated": "2019-07-04T16:00:29.043Z",
'   "object_id": "4a1e6ab7b1ba49ed9bc6cb1a8798e0fd",
'   "object_owner": "admin@chilkatsoft.com",
'   "object_state": "VALID",
'   "address_importer": null,
'   "certify_signer": "Simon Kreuz",
'   "certify": true,
'   "items": [
'     "4096c68693364b7ea0af72fb869ee861"
'   ],
'   "non_delivery_option": "RETURN",
'   "contents_type": "MERCHANDISE",
'   "contents_explanation": "",
'   "exporter_reference": "",
'   "importer_reference": "",
'   "invoice": "",
'   "commercial_invoice": false,
'   "license": "",
'   "certificate": "",
'   "notes": "",
'   "eel_pfc": "",
'   "aes_itn": "",
'   "disclaimer": "",
'   "incoterm": "DDU",
'   "metadata": "",
'   "test": true,
'   "duties_payor": null
' }

' 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 strVal As String

Dim object_created As String = jResp.StringOf("object_created")
Dim object_updated As String = jResp.StringOf("object_updated")
Dim object_id As String = jResp.StringOf("object_id")
Dim object_owner As String = jResp.StringOf("object_owner")
Dim object_state As String = jResp.StringOf("object_state")
Dim address_importer As String = jResp.StringOf("address_importer")
Dim certify_signer As String = jResp.StringOf("certify_signer")
Dim certify As Boolean = jResp.BoolOf("certify")
Dim non_delivery_option As String = jResp.StringOf("non_delivery_option")
Dim contents_type As String = jResp.StringOf("contents_type")
Dim contents_explanation As String = jResp.StringOf("contents_explanation")
Dim exporter_reference As String = jResp.StringOf("exporter_reference")
Dim importer_reference As String = jResp.StringOf("importer_reference")
Dim invoice As String = jResp.StringOf("invoice")
Dim commercial_invoice As Boolean = jResp.BoolOf("commercial_invoice")
Dim license As String = jResp.StringOf("license")
Dim certificate As String = jResp.StringOf("certificate")
Dim notes As String = jResp.StringOf("notes")
Dim eel_pfc As String = jResp.StringOf("eel_pfc")
Dim aes_itn As String = jResp.StringOf("aes_itn")
Dim disclaimer As String = jResp.StringOf("disclaimer")
Dim incoterm As String = jResp.StringOf("incoterm")
Dim metadata As String = jResp.StringOf("metadata")
Dim test As Boolean = jResp.BoolOf("test")
Dim duties_payor As String = jResp.StringOf("duties_payor")
Dim i As Integer = 0
Dim count_i As Integer = jResp.SizeOfArray("items")
While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("items[i]")
    i = i + 1
End While

 

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