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
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) Trello Create New Board

Create a new board.

For more information, see https://developers.trello.com/reference#boardsid

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

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

# curl --request POST \
#   --url 'https://api.trello.com/1/boards?name=name&defaultLabels=true&defaultLists=true&keepFromSource=none&prefs_permissionLevel=private
#           &prefs_voting=disabled&prefs_comments=members&prefs_invitations=members&prefs_selfJoin=true&prefs_cardCovers=true&prefs_background=blue&prefs_cardAging=regular'

# First get our previously obtained access token.
set jsonToken [new_CkJsonObject]

set success [CkJsonObject_LoadFile $jsonToken "qa_data/tokens/trello.json"]

set oauth1 [new_CkOAuth1]

CkOAuth1_put_ConsumerKey $oauth1 "TRELLO_CONSUMER_KEY"
CkOAuth1_put_ConsumerSecret $oauth1 "TRELLO_CONSUMER_SECRET"
CkOAuth1_put_Token $oauth1 [CkJsonObject_stringOf $jsonToken "oauth_token"]
CkOAuth1_put_TokenSecret $oauth1 [CkJsonObject_stringOf $jsonToken "oauth_token_secret"]

set rest [new_CkRest]

# Connect using TLS.
# A single REST object, once connected, can be used for many Trello REST API calls.
# The auto-reconnect indicates that if the already-established HTTPS connection is closed,
# then it will be automatically re-established as needed.
set bAutoReconnect 1
set success [CkRest_Connect $rest "api.trello.com" 443 1 $bAutoReconnect]
if {$success != 1} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkJsonObject $jsonToken
    delete_CkOAuth1 $oauth1
    delete_CkRest $rest
    exit
}

CkRest_SetAuthOAuth1 $rest $oauth1 0

CkRest_AddQueryParam $rest "name" "Football & Rugby"
CkRest_AddQueryParam $rest "defaultLabels" "true"
CkRest_AddQueryParam $rest "defaultLists" "true"
CkRest_AddQueryParam $rest "keepFromSource" "none"
CkRest_AddQueryParam $rest "prefs_permissionLevel" "private"
CkRest_AddQueryParam $rest "prefs_voting" "disabled"
CkRest_AddQueryParam $rest "prefs_comments" "members"
CkRest_AddQueryParam $rest "prefs_invitations" "members"
CkRest_AddQueryParam $rest "prefs_selfJoin" "true"
CkRest_AddQueryParam $rest "prefs_cardCovers" "true"
CkRest_AddQueryParam $rest "prefs_background" "blue"
CkRest_AddQueryParam $rest "prefs_cardAging" "regular"

CkRest_AddHeader $rest "Accept" "application/json"

set responseBody [CkRest_fullRequestFormUrlEncoded $rest "POST" "/1/boards"]
if {[CkRest_get_LastMethodSuccess $rest] != 1} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkJsonObject $jsonToken
    delete_CkOAuth1 $oauth1
    delete_CkRest $rest
    exit
}

# We should expect a 200 response if successful.
if {[CkRest_get_ResponseStatusCode $rest] != 200} then {
    puts "Request Header: "
    puts [CkRest_lastRequestHeader $rest]
    puts "----"
    puts "Response StatusCode = [CkRest_get_ResponseStatusCode $rest]"
    puts "Response StatusLine: [CkRest_responseStatusText $rest]"
    puts "Response Header:"
    puts [CkRest_responseHeader $rest]
    puts "$responseBody"
    delete_CkJsonObject $jsonToken
    delete_CkOAuth1 $oauth1
    delete_CkRest $rest
    exit
}

set json [new_CkJsonObject]

CkJsonObject_Load $json $responseBody
CkJsonObject_put_EmitCompact $json 0
puts [CkJsonObject_emit $json]
puts "Success."

# A sample JSON response:
# (See the parsing code below...)
# Use this online tool to generate parsing code from sample JSON: 
# Generate Parsing Code from JSON

# 
# {
#   "id": "5cc606a1e2441a8a8fe3dc48",
#   "name": "Football",
#   "desc": "",
#   "descData": null,
#   "closed": false,
#   "idOrganization": null,
#   "pinned": false,
#   "url": "https://trello.com/b/eadpS1Pe/football",
#   "shortUrl": "https://trello.com/b/eadpS1Pe",
#   "prefs": {
#     "permissionLevel": "private",
#     "voting": "disabled",
#     "comments": "members",
#     "invitations": "members",
#     "selfJoin": true,
#     "cardCovers": true,
#     "cardAging": "regular",
#     "calendarFeedEnabled": false,
#     "background": "blue",
#     "backgroundImage": null,
#     "backgroundImageScaled": null,
#     "backgroundTile": false,
#     "backgroundBrightness": "dark",
#     "backgroundColor": "#0079BF",
#     "backgroundBottomColor": "#0079BF",
#     "backgroundTopColor": "#0079BF",
#     "canBePublic": true,
#     "canBeEnterprise": true,
#     "canBeOrg": true,
#     "canBePrivate": true,
#     "canInvite": true
#   },
#   "labelNames": {
#     "green": "",
#     "yellow": "",
#     "orange": "",
#     "red": "",
#     "purple": "",
#     "blue": "",
#     "sky": "",
#     "lime": "",
#     "pink": "",
#     "black": ""
#   },
#   "limits": {}
# }

set id [CkJsonObject_stringOf $json "id"]
set name [CkJsonObject_stringOf $json "name"]
set desc [CkJsonObject_stringOf $json "desc"]
set descData [CkJsonObject_stringOf $json "descData"]
set closed [CkJsonObject_BoolOf $json "closed"]
set idOrganization [CkJsonObject_stringOf $json "idOrganization"]
set pinned [CkJsonObject_BoolOf $json "pinned"]
set url [CkJsonObject_stringOf $json "url"]
set shortUrl [CkJsonObject_stringOf $json "shortUrl"]
set prefsPermissionLevel [CkJsonObject_stringOf $json "prefs.permissionLevel"]
set prefsVoting [CkJsonObject_stringOf $json "prefs.voting"]
set prefsComments [CkJsonObject_stringOf $json "prefs.comments"]
set prefsInvitations [CkJsonObject_stringOf $json "prefs.invitations"]
set prefsSelfJoin [CkJsonObject_BoolOf $json "prefs.selfJoin"]
set prefsCardCovers [CkJsonObject_BoolOf $json "prefs.cardCovers"]
set prefsCardAging [CkJsonObject_stringOf $json "prefs.cardAging"]
set prefsCalendarFeedEnabled [CkJsonObject_BoolOf $json "prefs.calendarFeedEnabled"]
set prefsBackground [CkJsonObject_stringOf $json "prefs.background"]
set prefsBackgroundImage [CkJsonObject_stringOf $json "prefs.backgroundImage"]
set prefsBackgroundImageScaled [CkJsonObject_stringOf $json "prefs.backgroundImageScaled"]
set prefsBackgroundTile [CkJsonObject_BoolOf $json "prefs.backgroundTile"]
set prefsBackgroundBrightness [CkJsonObject_stringOf $json "prefs.backgroundBrightness"]
set prefsBackgroundColor [CkJsonObject_stringOf $json "prefs.backgroundColor"]
set prefsBackgroundBottomColor [CkJsonObject_stringOf $json "prefs.backgroundBottomColor"]
set prefsBackgroundTopColor [CkJsonObject_stringOf $json "prefs.backgroundTopColor"]
set prefsCanBePublic [CkJsonObject_BoolOf $json "prefs.canBePublic"]
set prefsCanBeEnterprise [CkJsonObject_BoolOf $json "prefs.canBeEnterprise"]
set prefsCanBeOrg [CkJsonObject_BoolOf $json "prefs.canBeOrg"]
set prefsCanBePrivate [CkJsonObject_BoolOf $json "prefs.canBePrivate"]
set prefsCanInvite [CkJsonObject_BoolOf $json "prefs.canInvite"]
set labelNamesGreen [CkJsonObject_stringOf $json "labelNames.green"]
set labelNamesYellow [CkJsonObject_stringOf $json "labelNames.yellow"]
set labelNamesOrange [CkJsonObject_stringOf $json "labelNames.orange"]
set labelNamesRed [CkJsonObject_stringOf $json "labelNames.red"]
set labelNamesPurple [CkJsonObject_stringOf $json "labelNames.purple"]
set labelNamesBlue [CkJsonObject_stringOf $json "labelNames.blue"]
set labelNamesSky [CkJsonObject_stringOf $json "labelNames.sky"]
set labelNamesLime [CkJsonObject_stringOf $json "labelNames.lime"]
set labelNamesPink [CkJsonObject_stringOf $json "labelNames.pink"]
set labelNamesBlack [CkJsonObject_stringOf $json "labelNames.black"]

delete_CkJsonObject $jsonToken
delete_CkOAuth1 $oauth1
delete_CkRest $rest
delete_CkJsonObject $json

 

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