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 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 ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcStrVal
LOCAL lcObject_created
LOCAL lcObject_updated
LOCAL lcObject_id
LOCAL lcObject_owner
LOCAL lcObject_state
LOCAL lcAddress_importer
LOCAL lcCertify_signer
LOCAL lnCertify
LOCAL lcNon_delivery_option
LOCAL lcContents_type
LOCAL lcContents_explanation
LOCAL lcExporter_reference
LOCAL lcImporter_reference
LOCAL lcInvoice
LOCAL lnCommercial_invoice
LOCAL lcLicense
LOCAL lcCertificate
LOCAL lcNotes
LOCAL lcEel_pfc
LOCAL lcAes_itn
LOCAL lcDisclaimer
LOCAL lcIncoterm
LOCAL lcMetadata
LOCAL lnTest
LOCAL lcDuties_payor
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/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"
*     }
*   ]
* }

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("contents_type","MERCHANDISE")
loJson.UpdateString("non_delivery_option","RETURN")
loJson.UpdateBool("certify",1)
loJson.UpdateString("certify_signer","Simon Kreuz")
loJson.UpdateString("incoterm","DDU")
loJson.UpdateString("items[0].description","T-shirt")
loJson.UpdateInt("items[0].quantity",20)
loJson.UpdateString("items[0].net_weight","5")
loJson.UpdateString("items[0].mass_unit","lb")
loJson.UpdateString("items[0].value_amount","200")
loJson.UpdateString("items[0].value_currency","USD")
loJson.UpdateString("items[0].tariff_number","")
loJson.UpdateString("items[0].origin_country","US")

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

loResp = loHttp.PostJson3("https://api.goshippo.com/customs/declarations/","application/json",loJson)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    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 loJson
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

* 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

lcObject_created = loJResp.StringOf("object_created")
lcObject_updated = loJResp.StringOf("object_updated")
lcObject_id = loJResp.StringOf("object_id")
lcObject_owner = loJResp.StringOf("object_owner")
lcObject_state = loJResp.StringOf("object_state")
lcAddress_importer = loJResp.StringOf("address_importer")
lcCertify_signer = loJResp.StringOf("certify_signer")
lnCertify = loJResp.BoolOf("certify")
lcNon_delivery_option = loJResp.StringOf("non_delivery_option")
lcContents_type = loJResp.StringOf("contents_type")
lcContents_explanation = loJResp.StringOf("contents_explanation")
lcExporter_reference = loJResp.StringOf("exporter_reference")
lcImporter_reference = loJResp.StringOf("importer_reference")
lcInvoice = loJResp.StringOf("invoice")
lnCommercial_invoice = loJResp.BoolOf("commercial_invoice")
lcLicense = loJResp.StringOf("license")
lcCertificate = loJResp.StringOf("certificate")
lcNotes = loJResp.StringOf("notes")
lcEel_pfc = loJResp.StringOf("eel_pfc")
lcAes_itn = loJResp.StringOf("aes_itn")
lcDisclaimer = loJResp.StringOf("disclaimer")
lcIncoterm = loJResp.StringOf("incoterm")
lcMetadata = loJResp.StringOf("metadata")
lnTest = loJResp.BoolOf("test")
lcDuties_payor = loJResp.StringOf("duties_payor")
i = 0
lnCount_i = loJResp.SizeOfArray("items")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcStrVal = loJResp.StringOf("items[i]")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loJson
RELEASE loSbResponseBody
RELEASE loJResp


 

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