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
(PowerBuilder) Trello Create New BoardCreate a new board. For more information, see https://developers.trello.com/reference#boardsid
integer li_rc oleobject loo_JsonToken integer li_Success oleobject loo_Oauth1 oleobject loo_Rest integer li_BAutoReconnect string ls_ResponseBody oleobject loo_Json string ls_Id string ls_Name string ls_Desc string ls_DescData integer li_Closed string ls_IdOrganization integer li_Pinned string ls_Url string ls_ShortUrl string ls_PrefsPermissionLevel string ls_PrefsVoting string ls_PrefsComments string ls_PrefsInvitations integer li_PrefsSelfJoin integer li_PrefsCardCovers string ls_PrefsCardAging integer li_PrefsCalendarFeedEnabled string ls_PrefsBackground string ls_PrefsBackgroundImage string ls_PrefsBackgroundImageScaled integer li_PrefsBackgroundTile string ls_PrefsBackgroundBrightness string ls_PrefsBackgroundColor string ls_PrefsBackgroundBottomColor string ls_PrefsBackgroundTopColor integer li_PrefsCanBePublic integer li_PrefsCanBeEnterprise integer li_PrefsCanBeOrg integer li_PrefsCanBePrivate integer li_PrefsCanInvite string ls_LabelNamesGreen string ls_LabelNamesYellow string ls_LabelNamesOrange string ls_LabelNamesRed string ls_LabelNamesPurple string ls_LabelNamesBlue string ls_LabelNamesSky string ls_LabelNamesLime string ls_LabelNamesPink string ls_LabelNamesBlack // 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. loo_JsonToken = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JsonToken.ConnectToNewObject("Chilkat.JsonObject") if li_rc < 0 then destroy loo_JsonToken MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_JsonToken.LoadFile("qa_data/tokens/trello.json") loo_Oauth1 = create oleobject // Use "Chilkat_9_5_0.OAuth1" for versions of Chilkat < 10.0.0 li_rc = loo_Oauth1.ConnectToNewObject("Chilkat.OAuth1") loo_Oauth1.ConsumerKey = "TRELLO_CONSUMER_KEY" loo_Oauth1.ConsumerSecret = "TRELLO_CONSUMER_SECRET" loo_Oauth1.Token = loo_JsonToken.StringOf("oauth_token") loo_Oauth1.TokenSecret = loo_JsonToken.StringOf("oauth_token_secret") loo_Rest = create oleobject // Use "Chilkat_9_5_0.Rest" for versions of Chilkat < 10.0.0 li_rc = loo_Rest.ConnectToNewObject("Chilkat.Rest") // 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. li_BAutoReconnect = 1 li_Success = loo_Rest.Connect("api.trello.com",443,1,li_BAutoReconnect) if li_Success <> 1 then Write-Debug loo_Rest.LastErrorText destroy loo_JsonToken destroy loo_Oauth1 destroy loo_Rest return end if loo_Rest.SetAuthOAuth1(loo_Oauth1,0) loo_Rest.AddQueryParam("name","Football & Rugby") loo_Rest.AddQueryParam("defaultLabels","true") loo_Rest.AddQueryParam("defaultLists","true") loo_Rest.AddQueryParam("keepFromSource","none") loo_Rest.AddQueryParam("prefs_permissionLevel","private") loo_Rest.AddQueryParam("prefs_voting","disabled") loo_Rest.AddQueryParam("prefs_comments","members") loo_Rest.AddQueryParam("prefs_invitations","members") loo_Rest.AddQueryParam("prefs_selfJoin","true") loo_Rest.AddQueryParam("prefs_cardCovers","true") loo_Rest.AddQueryParam("prefs_background","blue") loo_Rest.AddQueryParam("prefs_cardAging","regular") loo_Rest.AddHeader("Accept","application/json") ls_ResponseBody = loo_Rest.FullRequestFormUrlEncoded("POST","/1/boards") if loo_Rest.LastMethodSuccess <> 1 then Write-Debug loo_Rest.LastErrorText destroy loo_JsonToken destroy loo_Oauth1 destroy loo_Rest return end if // We should expect a 200 response if successful. if loo_Rest.ResponseStatusCode <> 200 then Write-Debug "Request Header: " Write-Debug loo_Rest.LastRequestHeader Write-Debug "----" Write-Debug "Response StatusCode = " + string(loo_Rest.ResponseStatusCode) Write-Debug "Response StatusLine: " + loo_Rest.ResponseStatusText Write-Debug "Response Header:" Write-Debug loo_Rest.ResponseHeader Write-Debug ls_ResponseBody destroy loo_JsonToken destroy loo_Oauth1 destroy loo_Rest return end if loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.Load(ls_ResponseBody) loo_Json.EmitCompact = 0 Write-Debug loo_Json.Emit() Write-Debug "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": {} // } ls_Id = loo_Json.StringOf("id") ls_Name = loo_Json.StringOf("name") ls_Desc = loo_Json.StringOf("desc") ls_DescData = loo_Json.StringOf("descData") li_Closed = loo_Json.BoolOf("closed") ls_IdOrganization = loo_Json.StringOf("idOrganization") li_Pinned = loo_Json.BoolOf("pinned") ls_Url = loo_Json.StringOf("url") ls_ShortUrl = loo_Json.StringOf("shortUrl") ls_PrefsPermissionLevel = loo_Json.StringOf("prefs.permissionLevel") ls_PrefsVoting = loo_Json.StringOf("prefs.voting") ls_PrefsComments = loo_Json.StringOf("prefs.comments") ls_PrefsInvitations = loo_Json.StringOf("prefs.invitations") li_PrefsSelfJoin = loo_Json.BoolOf("prefs.selfJoin") li_PrefsCardCovers = loo_Json.BoolOf("prefs.cardCovers") ls_PrefsCardAging = loo_Json.StringOf("prefs.cardAging") li_PrefsCalendarFeedEnabled = loo_Json.BoolOf("prefs.calendarFeedEnabled") ls_PrefsBackground = loo_Json.StringOf("prefs.background") ls_PrefsBackgroundImage = loo_Json.StringOf("prefs.backgroundImage") ls_PrefsBackgroundImageScaled = loo_Json.StringOf("prefs.backgroundImageScaled") li_PrefsBackgroundTile = loo_Json.BoolOf("prefs.backgroundTile") ls_PrefsBackgroundBrightness = loo_Json.StringOf("prefs.backgroundBrightness") ls_PrefsBackgroundColor = loo_Json.StringOf("prefs.backgroundColor") ls_PrefsBackgroundBottomColor = loo_Json.StringOf("prefs.backgroundBottomColor") ls_PrefsBackgroundTopColor = loo_Json.StringOf("prefs.backgroundTopColor") li_PrefsCanBePublic = loo_Json.BoolOf("prefs.canBePublic") li_PrefsCanBeEnterprise = loo_Json.BoolOf("prefs.canBeEnterprise") li_PrefsCanBeOrg = loo_Json.BoolOf("prefs.canBeOrg") li_PrefsCanBePrivate = loo_Json.BoolOf("prefs.canBePrivate") li_PrefsCanInvite = loo_Json.BoolOf("prefs.canInvite") ls_LabelNamesGreen = loo_Json.StringOf("labelNames.green") ls_LabelNamesYellow = loo_Json.StringOf("labelNames.yellow") ls_LabelNamesOrange = loo_Json.StringOf("labelNames.orange") ls_LabelNamesRed = loo_Json.StringOf("labelNames.red") ls_LabelNamesPurple = loo_Json.StringOf("labelNames.purple") ls_LabelNamesBlue = loo_Json.StringOf("labelNames.blue") ls_LabelNamesSky = loo_Json.StringOf("labelNames.sky") ls_LabelNamesLime = loo_Json.StringOf("labelNames.lime") ls_LabelNamesPink = loo_Json.StringOf("labelNames.pink") ls_LabelNamesBlack = loo_Json.StringOf("labelNames.black") destroy loo_JsonToken destroy loo_Oauth1 destroy loo_Rest destroy loo_Json |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.