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

Xojo Plugin 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
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

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
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
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

 

 

 

(Xojo Plugin) Shippo Adding Metadata

Demonstrates how to add metadata to the tracking request through a POST request.

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

Chilkat Xojo Plugin Download

Xojo Plugin for Windows, Linux, Mac OS X, and ARM, ARM64

// 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/tracks/ \
//     -H "Authorization: ShippoToken <API_TOKEN>" \
//     -d carrier="shippo" \
//     -d tracking_number="SHIPPO_TRANSIT" \
//     -d metadata="Order 000123"

Dim req As New Chilkat.HttpRequest
req.HttpVerb = "POST"
req.Path = "/tracks/"
req.ContentType = "application/x-www-form-urlencoded"
req.AddParam "carrier","shippo"
req.AddParam "tracking_number","SHIPPO_TRANSIT"
req.AddParam "metadata","Order 000123"

req.AddHeader "Authorization","ShippoToken <API_TOKEN>"

Dim resp As Chilkat.HttpResponse
resp = http.PostUrlEncoded("https://api.goshippo.com/tracks/",req)
If (http.LastMethodSuccess = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

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

System.DebugLog("Response Body:")
System.DebugLog(jResp.Emit())

Dim respStatusCode As Int32
respStatusCode = resp.StatusCode
System.DebugLog("Response Status Code = " + Str(respStatusCode))
If (respStatusCode >= 400) Then
    System.DebugLog("Response Header:")
    System.DebugLog(resp.Header)
    System.DebugLog("Failed.")

    Return
End If

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

// {
//   "messages": [
//   ],
//   "carrier": "shippo",
//   "tracking_number": "SHIPPO_TRANSIT",
//   "address_from": {
//     "city": "San Francisco",
//     "state": "CA",
//     "zip": "94103",
//     "country": "US"
//   },
//   "address_to": {
//     "city": "Chicago",
//     "state": "IL",
//     "zip": "60611",
//     "country": "US"
//   },
//   "eta": "2019-07-07T17:07:44.989Z",
//   "original_eta": "2019-07-07T17:07:44.989Z",
//   "servicelevel": {
//     "token": "shippo_priority",
//     "name": "Priority Mail"
//   },
//   "metadata": "Shippo test tracking",
//   "tracking_status": {
//     "object_created": "2019-07-04T17:07:45.003Z",
//     "object_updated": null,
//     "object_id": "ee35fb56f5d04021b36168abedc04573",
//     "status": "TRANSIT",
//     "status_details": "Your shipment has departed from the origin.",
//     "status_date": "2019-07-03T15:02:45.003Z",
//     "substatus": null,
//     "location": {
//       "city": "San Francisco",
//       "state": "CA",
//       "zip": "94103",
//       "country": "US"
//     }
//   },
//   "tracking_history": [
//     {
//       "object_created": "2019-07-04T17:07:45.005Z",
//       "object_updated": null,
//       "object_id": "2121a59f53ed42e0ae0436f636179156",
//       "status": "UNKNOWN",
//       "status_details": "The carrier has received the electronic shipment information.",
//       "status_date": "2019-07-02T12:57:45.005Z",
//       "substatus": null,
//       "location": {
//         "city": "San Francisco",
//         "state": "CA",
//         "zip": "94103",
//         "country": "US"
//       }
//     },
//     {
//       "object_created": "2019-07-04T17:07:45.005Z",
//       "object_updated": null,
//       "object_id": "06f949db1a8245beaa28df264b368a76",
//       "status": "TRANSIT",
//       "status_details": "Your shipment has departed from the origin.",
//       "status_date": "2019-07-03T15:02:45.005Z",
//       "substatus": null,
//       "location": {
//         "city": "San Francisco",
//         "state": "CA",
//         "zip": "94103",
//         "country": "US"
//       }
//     }
//   ],
//   "transaction": null,
//   "test": 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 object_created As String
Dim object_updated As String
Dim object_id As String
Dim status As String
Dim status_details As String
Dim status_date As String
Dim substatus As String
Dim locationCity As String
Dim locationState As String
Dim locationZip As String
Dim locationCountry As String

Dim carrier As String
carrier = jResp.StringOf("carrier")
Dim tracking_number As String
tracking_number = jResp.StringOf("tracking_number")
Dim address_fromCity As String
address_fromCity = jResp.StringOf("address_from.city")
Dim address_fromState As String
address_fromState = jResp.StringOf("address_from.state")
Dim address_fromZip As String
address_fromZip = jResp.StringOf("address_from.zip")
Dim address_fromCountry As String
address_fromCountry = jResp.StringOf("address_from.country")
Dim address_toCity As String
address_toCity = jResp.StringOf("address_to.city")
Dim address_toState As String
address_toState = jResp.StringOf("address_to.state")
Dim address_toZip As String
address_toZip = jResp.StringOf("address_to.zip")
Dim address_toCountry As String
address_toCountry = jResp.StringOf("address_to.country")
Dim eta As String
eta = jResp.StringOf("eta")
Dim original_eta As String
original_eta = jResp.StringOf("original_eta")
Dim servicelevelToken As String
servicelevelToken = jResp.StringOf("servicelevel.token")
Dim servicelevelName As String
servicelevelName = jResp.StringOf("servicelevel.name")
Dim metadata As String
metadata = jResp.StringOf("metadata")
Dim tracking_statusObject_created As String
tracking_statusObject_created = jResp.StringOf("tracking_status.object_created")
Dim tracking_statusObject_updated As String
tracking_statusObject_updated = jResp.StringOf("tracking_status.object_updated")
Dim tracking_statusObject_id As String
tracking_statusObject_id = jResp.StringOf("tracking_status.object_id")
Dim tracking_statusStatus As String
tracking_statusStatus = jResp.StringOf("tracking_status.status")
Dim tracking_statusStatus_details As String
tracking_statusStatus_details = jResp.StringOf("tracking_status.status_details")
Dim tracking_statusStatus_date As String
tracking_statusStatus_date = jResp.StringOf("tracking_status.status_date")
Dim tracking_statusSubstatus As String
tracking_statusSubstatus = jResp.StringOf("tracking_status.substatus")
Dim tracking_statusLocationCity As String
tracking_statusLocationCity = jResp.StringOf("tracking_status.location.city")
Dim tracking_statusLocationState As String
tracking_statusLocationState = jResp.StringOf("tracking_status.location.state")
Dim tracking_statusLocationZip As String
tracking_statusLocationZip = jResp.StringOf("tracking_status.location.zip")
Dim tracking_statusLocationCountry As String
tracking_statusLocationCountry = jResp.StringOf("tracking_status.location.country")
Dim transaction As String
transaction = jResp.StringOf("transaction")
Dim test As Boolean
test = jResp.BoolOf("test")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = jResp.SizeOfArray("messages")
While i < count_i
    jResp.I = i
    i = i + 1
Wend
i = 0
count_i = jResp.SizeOfArray("tracking_history")
While i < count_i
    jResp.I = i
    object_created = jResp.StringOf("tracking_history[i].object_created")
    object_updated = jResp.StringOf("tracking_history[i].object_updated")
    object_id = jResp.StringOf("tracking_history[i].object_id")
    status = jResp.StringOf("tracking_history[i].status")
    status_details = jResp.StringOf("tracking_history[i].status_details")
    status_date = jResp.StringOf("tracking_history[i].status_date")
    substatus = jResp.StringOf("tracking_history[i].substatus")
    locationCity = jResp.StringOf("tracking_history[i].location.city")
    locationState = jResp.StringOf("tracking_history[i].location.state")
    locationZip = jResp.StringOf("tracking_history[i].location.zip")
    locationCountry = jResp.StringOf("tracking_history[i].location.country")
    i = i + 1
Wend

 

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