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

Visual FoxPro 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

 

 

 

(Visual FoxPro) 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 ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL lnSuccess
LOCAL loReq
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcObject_created
LOCAL lcObject_updated
LOCAL lcObject_id
LOCAL lcStatus
LOCAL lcStatus_details
LOCAL lcStatus_date
LOCAL lcSubstatus
LOCAL lcLocationCity
LOCAL lcLocationState
LOCAL lcLocationZip
LOCAL lcLocationCountry
LOCAL lcCarrier
LOCAL lcTracking_number
LOCAL lcAddress_fromCity
LOCAL lcAddress_fromState
LOCAL lcAddress_fromZip
LOCAL lcAddress_fromCountry
LOCAL lcAddress_toCity
LOCAL lcAddress_toState
LOCAL lcAddress_toZip
LOCAL lcAddress_toCountry
LOCAL lcEta
LOCAL lcOriginal_eta
LOCAL lcServicelevelToken
LOCAL lcServicelevelName
LOCAL lcMetadata
LOCAL lcTracking_statusObject_created
LOCAL lcTracking_statusObject_updated
LOCAL lcTracking_statusObject_id
LOCAL lcTracking_statusStatus
LOCAL lcTracking_statusStatus_details
LOCAL lcTracking_statusStatus_date
LOCAL lcTracking_statusSubstatus
LOCAL lcTracking_statusLocationCity
LOCAL lcTracking_statusLocationState
LOCAL lcTracking_statusLocationZip
LOCAL lcTracking_statusLocationCountry
LOCAL lcTransaction
LOCAL lnTest
LOCAL i
LOCAL lnCount_i

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

* 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"

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.HttpRequest')
loReq = CreateObject('Chilkat.HttpRequest')
loReq.HttpVerb = "POST"
loReq.Path = "/tracks/"
loReq.ContentType = "application/x-www-form-urlencoded"
loReq.AddParam("carrier","shippo")
loReq.AddParam("tracking_number","SHIPPO_TRANSIT")
loReq.AddParam("metadata","Order 000123")

loReq.AddHeader("Authorization","ShippoToken <API_TOKEN>")

loResp = loHttp.PostUrlEncoded("https://api.goshippo.com/tracks/",loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loReq
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loReq
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

* 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

lcCarrier = loJResp.StringOf("carrier")
lcTracking_number = loJResp.StringOf("tracking_number")
lcAddress_fromCity = loJResp.StringOf("address_from.city")
lcAddress_fromState = loJResp.StringOf("address_from.state")
lcAddress_fromZip = loJResp.StringOf("address_from.zip")
lcAddress_fromCountry = loJResp.StringOf("address_from.country")
lcAddress_toCity = loJResp.StringOf("address_to.city")
lcAddress_toState = loJResp.StringOf("address_to.state")
lcAddress_toZip = loJResp.StringOf("address_to.zip")
lcAddress_toCountry = loJResp.StringOf("address_to.country")
lcEta = loJResp.StringOf("eta")
lcOriginal_eta = loJResp.StringOf("original_eta")
lcServicelevelToken = loJResp.StringOf("servicelevel.token")
lcServicelevelName = loJResp.StringOf("servicelevel.name")
lcMetadata = loJResp.StringOf("metadata")
lcTracking_statusObject_created = loJResp.StringOf("tracking_status.object_created")
lcTracking_statusObject_updated = loJResp.StringOf("tracking_status.object_updated")
lcTracking_statusObject_id = loJResp.StringOf("tracking_status.object_id")
lcTracking_statusStatus = loJResp.StringOf("tracking_status.status")
lcTracking_statusStatus_details = loJResp.StringOf("tracking_status.status_details")
lcTracking_statusStatus_date = loJResp.StringOf("tracking_status.status_date")
lcTracking_statusSubstatus = loJResp.StringOf("tracking_status.substatus")
lcTracking_statusLocationCity = loJResp.StringOf("tracking_status.location.city")
lcTracking_statusLocationState = loJResp.StringOf("tracking_status.location.state")
lcTracking_statusLocationZip = loJResp.StringOf("tracking_status.location.zip")
lcTracking_statusLocationCountry = loJResp.StringOf("tracking_status.location.country")
lcTransaction = loJResp.StringOf("transaction")
lnTest = loJResp.BoolOf("test")
i = 0
lnCount_i = loJResp.SizeOfArray("messages")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("tracking_history")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcObject_created = loJResp.StringOf("tracking_history[i].object_created")
    lcObject_updated = loJResp.StringOf("tracking_history[i].object_updated")
    lcObject_id = loJResp.StringOf("tracking_history[i].object_id")
    lcStatus = loJResp.StringOf("tracking_history[i].status")
    lcStatus_details = loJResp.StringOf("tracking_history[i].status_details")
    lcStatus_date = loJResp.StringOf("tracking_history[i].status_date")
    lcSubstatus = loJResp.StringOf("tracking_history[i].substatus")
    lcLocationCity = loJResp.StringOf("tracking_history[i].location.city")
    lcLocationState = loJResp.StringOf("tracking_history[i].location.state")
    lcLocationZip = loJResp.StringOf("tracking_history[i].location.zip")
    lcLocationCountry = loJResp.StringOf("tracking_history[i].location.country")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loReq
RELEASE loSbResponseBody
RELEASE loJResp


 

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