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

CkPython 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

 

 

 

(CkPython) Trello Create New Board

Create a new board.

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

Chilkat Python Downloads

install with pip

pip3 install chilkat

or download... Python Module for Windows, MacOS, Linux, Alpine Linux, Solaris

import sys
import chilkat

# 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.
jsonToken = chilkat.CkJsonObject()
success = jsonToken.LoadFile("qa_data/tokens/trello.json")

oauth1 = chilkat.CkOAuth1()
oauth1.put_ConsumerKey("TRELLO_CONSUMER_KEY")
oauth1.put_ConsumerSecret("TRELLO_CONSUMER_SECRET")
oauth1.put_Token(jsonToken.stringOf("oauth_token"))
oauth1.put_TokenSecret(jsonToken.stringOf("oauth_token_secret"))

rest = chilkat.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.
bAutoReconnect = True
success = rest.Connect("api.trello.com",443,True,bAutoReconnect)
if (success != True):
    print(rest.lastErrorText())
    sys.exit()

rest.SetAuthOAuth1(oauth1,False)

rest.AddQueryParam("name","Football & Rugby")
rest.AddQueryParam("defaultLabels","true")
rest.AddQueryParam("defaultLists","true")
rest.AddQueryParam("keepFromSource","none")
rest.AddQueryParam("prefs_permissionLevel","private")
rest.AddQueryParam("prefs_voting","disabled")
rest.AddQueryParam("prefs_comments","members")
rest.AddQueryParam("prefs_invitations","members")
rest.AddQueryParam("prefs_selfJoin","true")
rest.AddQueryParam("prefs_cardCovers","true")
rest.AddQueryParam("prefs_background","blue")
rest.AddQueryParam("prefs_cardAging","regular")

rest.AddHeader("Accept","application/json")

responseBody = rest.fullRequestFormUrlEncoded("POST","/1/boards")
if (rest.get_LastMethodSuccess() != True):
    print(rest.lastErrorText())
    sys.exit()

# We should expect a 200 response if successful.
if (rest.get_ResponseStatusCode() != 200):
    print("Request Header: ")
    print(rest.lastRequestHeader())
    print("----")
    print("Response StatusCode = " + str(rest.get_ResponseStatusCode()))
    print("Response StatusLine: " + rest.responseStatusText())
    print("Response Header:")
    print(rest.responseHeader())
    print(responseBody)
    sys.exit()

json = chilkat.CkJsonObject()
json.Load(responseBody)
json.put_EmitCompact(False)
print(json.emit())
print("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": {}
# }

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

 

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