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

Tcl 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

 

 

 

(Tcl) TicketBAI -- Send HTTP POST

See more TicketBAI Examples

Demonstrates how to send a TicketBAI POST and get the response.

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

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

set http [new_CkHttp]

set success [CkHttp_SetSslClientCertPfx $http "your.pfx" "pfx_password"]
if {$success == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    exit
}

# Get the XML we wish to send in the body of the request.
set sbXml [new_CkStringBuilder]

set success [CkStringBuilder_LoadFile $sbXml "qa_data/payload.xml" "utf-8"]
if {$success == 0} then {
    puts "Failed to load XML that is to be the HTTP request body"
    delete_CkHttp $http
    delete_CkStringBuilder $sbXml
    exit
}

# Build the following JSON

# { 
#     "con": "LROE", 
#     "apa": "1.1", 
#     "inte": { 
#         "nif": "número de identificación fiscal", 
#         "nrs": "nombre o Razón social", 
#         "ap1": "primer apellido", 
#         "ap2": "segundo apellido" 
#     }, 
#     "drs": { 
#     "mode": "140/240", 
#     "ejer": "ejercicio" 
#     } 
# }

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

set json [new_CkJsonObject]

CkJsonObject_UpdateString $json "con" "LROE"
CkJsonObject_UpdateString $json "apa" "1.1"
CkJsonObject_UpdateString $json "inte.nif" "número de identificación fiscal"
CkJsonObject_UpdateString $json "inte.nrs" "nombre o Razón social"
CkJsonObject_UpdateString $json "inte.ap1" "primer apellido"
CkJsonObject_UpdateString $json "inte.ap2" "segundo apellido"
CkJsonObject_UpdateString $json "drs.mode" "140/240"
CkJsonObject_UpdateString $json "drs.ejer" "ejercicio"

# Add required headers...
CkHttp_SetRequestHeader $http "eus-bizkaia-n3-version" "1.0"
CkHttp_SetRequestHeader $http "eus-bizkaia-n3-content-type" "application/xml"
CkHttp_SetRequestHeader $http "eus-bizkaia-n3-data" [CkJsonObject_emit $json]

set url "https://pruesarrerak.bizkaia.eus/N3B4000M/aurkezpena"
set bGzip 1
# resp is a CkHttpResponse
set resp [CkHttp_PTextSb $http "POST" $url $sbXml "utf-8" "application/octet-stream" 0 $bGzip]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkStringBuilder $sbXml
    delete_CkJsonObject $json
    exit
}

CkHttp_ClearHeaders $http

puts "response status code: [CkHttpResponse_get_StatusCode $resp]"

# Examine the response (it is already decompressed)
puts "response body:"
puts [CkHttpResponse_bodyStr $resp]

delete_CkHttpResponse $resp


delete_CkHttp $http
delete_CkStringBuilder $sbXml
delete_CkJsonObject $json

 

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