Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Tcl) Trello List Member BoardsLists the boards that the user is a member of. For more information, see https://developers.trello.com/reference#membersidboards
load ./chilkat.dll # This example assumes the Chilkat API to have been previously unlocked. # See Global Unlock Sample for sample code. # curl --request GET \ # --url 'https://api.trello.com/1/members/{member_id}/boards?filter=all&fields=all&lists=none&memberships=none&organization=false&organization_fields=displayName' # 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 "filter" "all" CkRest_AddQueryParam $rest "fields" "all" CkRest_AddQueryParam $rest "lists" "none" CkRest_AddQueryParam $rest "memberships" "normal" CkRest_AddQueryParam $rest "organization" "false" CkRest_AddQueryParam $rest "organization_fields" "name,displayName" CkRest_AddHeader $rest "Accept" "application/json" set responseBody [CkRest_fullRequestNoBody $rest "GET" "/1/members/member_id/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 jarr [new_CkJsonArray] CkJsonArray_Load $jarr $responseBody CkJsonArray_put_EmitCompact $jarr 0 puts [CkJsonArray_emit $jarr] 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 # [ # { # "name": "House Projects", # "desc": "", # "descData": null, # "closed": false, # "idOrganization": null, # "limits": null, # "pinned": null, # "shortLink": "j1hkQKKS", # "powerUps": [ # ], # "dateLastActivity": null, # "idTags": [ # ], # "datePluginDisable": null, # "creationMethod": null, # "ixUpdate": null, # "id": "5cc5fe862106bb8e05aa41e7", # "starred": false, # "url": "https://trello.com/b/j1hkQKKS/house-projects", # "prefs": { # "permissionLevel": "private", # "voting": "disabled", # "comments": "members", # "invitations": "members", # "selfJoin": false, # "cardCovers": true, # "cardAging": "regular", # "calendarFeedEnabled": false, # "background": "5cc344f6ba4cdc5f5cfc7d81", # "backgroundImage": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/2560x1709/4418c78f2f66d26932fef88aead2aff5/photo-1555985202-12975b0235dc", # "backgroundImageScaled": [ # { # "width": 140, # "height": 93, # "url": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/140x93/0aebced0ac2d8c9c4b9231b1960d28c2/photo-1555985202-12975b0235dc.jpg" # }, # ... # { # "width": 2560, # "height": 1709, # "url": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/2560x1709/4418c78f2f66d26932fef88aead2aff5/photo-1555985202-12975b0235dc" # } # ], # "backgroundTile": false, # "backgroundBrightness": "dark", # "backgroundBottomColor": "#412f23", # "backgroundTopColor": "#a99d97", # "canBePublic": true, # "canBeEnterprise": true, # "canBeOrg": true, # "canBePrivate": true, # "canInvite": true # }, # "subscribed": false, # "labelNames": { # "green": "", # "yellow": "", # "orange": "", # "red": "", # "purple": "", # "blue": "", # "sky": "", # "lime": "", # "pink": "", # "black": "" # }, # "dateLastView": "2019-04-28T19:28:18.159Z", # "shortUrl": "https://trello.com/b/j1hkQKKS", # "memberships": [ # { # "id": "5cc5fe862106bb8e05aa41e8", # "idMember": "5cc5c74067d5215921ca7677", # "memberType": "admin", # "unconfirmed": false, # "deactivated": false # } # ] # }, # { # "name": "Vacation Planning", # "desc": "", # "descData": null, # "closed": false, # "idOrganization": null, # "limits": null, # "pinned": null, # "shortLink": "QqIHvQyz", # "powerUps": [ # ], # "dateLastActivity": "2019-04-28T15:32:20.134Z", # "idTags": [ # ], # "datePluginDisable": null, # "creationMethod": "assisted", # "ixUpdate": null, # "id": "5cc5c783f5b10f8717a6b3d6", # "starred": false, # "url": "https://trello.com/b/QqIHvQyz/vacation-planning", # "prefs": { # "permissionLevel": "private", # "voting": "disabled", # "comments": "members", # "invitations": "members", # "selfJoin": true, # "cardCovers": true, # "cardAging": "regular", # "calendarFeedEnabled": false, # "background": "lime", # "backgroundImage": null, # "backgroundImageScaled": null, # "backgroundTile": false, # "backgroundBrightness": "dark", # "backgroundColor": "#4BBF6B", # "backgroundBottomColor": "#4BBF6B", # "backgroundTopColor": "#4BBF6B", # "canBePublic": true, # "canBeEnterprise": true, # "canBeOrg": true, # "canBePrivate": true, # "canInvite": true # }, # "subscribed": false, # "labelNames": { # "green": "", # "yellow": "", # "orange": "", # "red": "", # "purple": "", # "blue": "", # "sky": "", # "lime": "", # "pink": "", # "black": "" # }, # "dateLastView": "2019-04-28T19:32:21.009Z", # "shortUrl": "https://trello.com/b/QqIHvQyz", # "memberships": [ # { # "id": "5cc5c783f5b10f8717a6b3d7", # "idMember": "5cc5c74067d5215921ca7677", # "memberType": "admin", # "unconfirmed": false, # "deactivated": false # } # ] # } # ] # json is a CkJsonObject set i 0 set count_i [CkJsonArray_get_Size $jarr] while {$i < $count_i} { set json [CkJsonArray_ObjectAt $jarr $i] 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 limits [CkJsonObject_stringOf $json "limits"] set pinned [CkJsonObject_stringOf $json "pinned"] set shortLink [CkJsonObject_stringOf $json "shortLink"] set dateLastActivity [CkJsonObject_stringOf $json "dateLastActivity"] set datePluginDisable [CkJsonObject_stringOf $json "datePluginDisable"] set creationMethod [CkJsonObject_stringOf $json "creationMethod"] set ixUpdate [CkJsonObject_stringOf $json "ixUpdate"] set id [CkJsonObject_stringOf $json "id"] set starred [CkJsonObject_BoolOf $json "starred"] set url [CkJsonObject_stringOf $json "url"] 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 prefsBackgroundTile [CkJsonObject_BoolOf $json "prefs.backgroundTile"] set prefsBackgroundBrightness [CkJsonObject_stringOf $json "prefs.backgroundBrightness"] 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 subscribed [CkJsonObject_BoolOf $json "subscribed"] 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"] set dateLastView [CkJsonObject_stringOf $json "dateLastView"] set shortUrl [CkJsonObject_stringOf $json "shortUrl"] set prefsBackgroundImageScaled [CkJsonObject_stringOf $json "prefs.backgroundImageScaled"] set prefsBackgroundColor [CkJsonObject_stringOf $json "prefs.backgroundColor"] set j 0 set count_j [CkJsonObject_SizeOfArray $json "powerUps"] while {$j < $count_j} { CkJsonObject_put_J $json $j # ... set j [expr $j + 1] } set j 0 set count_j [CkJsonObject_SizeOfArray $json "idTags"] while {$j < $count_j} { CkJsonObject_put_J $json $j # ... set j [expr $j + 1] } set j 0 set count_j [CkJsonObject_SizeOfArray $json "prefs.backgroundImageScaled"] while {$j < $count_j} { CkJsonObject_put_J $json $j set width [CkJsonObject_IntOf $json "prefs.backgroundImageScaled[j].width"] set height [CkJsonObject_IntOf $json "prefs.backgroundImageScaled[j].height"] set url [CkJsonObject_stringOf $json "prefs.backgroundImageScaled[j].url"] set j [expr $j + 1] } set j 0 set count_j [CkJsonObject_SizeOfArray $json "memberships"] while {$j < $count_j} { CkJsonObject_put_J $json $j set id [CkJsonObject_stringOf $json "memberships[j].id"] set idMember [CkJsonObject_stringOf $json "memberships[j].idMember"] set memberType [CkJsonObject_stringOf $json "memberships[j].memberType"] set unconfirmed [CkJsonObject_BoolOf $json "memberships[j].unconfirmed"] set deactivated [CkJsonObject_BoolOf $json "memberships[j].deactivated"] set j [expr $j + 1] } delete_CkJsonObject $json set i [expr $i + 1] } delete_CkJsonObject $jsonToken delete_CkOAuth1 $oauth1 delete_CkRest $rest delete_CkJsonArray $jarr |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.