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
(Xojo Plugin) Trello Create New BoardCreate a new board. For more information, see https://developers.trello.com/reference#boardsid
// 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. Dim jsonToken As New Chilkat.JsonObject Dim success As Boolean success = jsonToken.LoadFile("qa_data/tokens/trello.json") Dim oauth1 As New Chilkat.OAuth1 oauth1.ConsumerKey = "TRELLO_CONSUMER_KEY" oauth1.ConsumerSecret = "TRELLO_CONSUMER_SECRET" oauth1.Token = jsonToken.StringOf("oauth_token") oauth1.TokenSecret = jsonToken.StringOf("oauth_token_secret") Dim rest As New 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. Dim bAutoReconnect As Boolean bAutoReconnect = True success = rest.Connect("api.trello.com",443,True,bAutoReconnect) If (success <> True) Then System.DebugLog(rest.LastErrorText) Return End If success = rest.SetAuthOAuth1(oauth1,False) success = rest.AddQueryParam("name","Football & Rugby") success = rest.AddQueryParam("defaultLabels","true") success = rest.AddQueryParam("defaultLists","true") success = rest.AddQueryParam("keepFromSource","none") success = rest.AddQueryParam("prefs_permissionLevel","private") success = rest.AddQueryParam("prefs_voting","disabled") success = rest.AddQueryParam("prefs_comments","members") success = rest.AddQueryParam("prefs_invitations","members") success = rest.AddQueryParam("prefs_selfJoin","true") success = rest.AddQueryParam("prefs_cardCovers","true") success = rest.AddQueryParam("prefs_background","blue") success = rest.AddQueryParam("prefs_cardAging","regular") success = rest.AddHeader("Accept","application/json") Dim responseBody As String responseBody = rest.FullRequestFormUrlEncoded("POST","/1/boards") If (rest.LastMethodSuccess <> True) Then System.DebugLog(rest.LastErrorText) Return End If // We should expect a 200 response if successful. If (rest.ResponseStatusCode <> 200) Then System.DebugLog("Request Header: ") System.DebugLog(rest.LastRequestHeader) System.DebugLog("----") System.DebugLog("Response StatusCode = " + Str(rest.ResponseStatusCode)) System.DebugLog("Response StatusLine: " + rest.ResponseStatusText) System.DebugLog("Response Header:") System.DebugLog(rest.ResponseHeader) System.DebugLog(responseBody) Return End If Dim json As New Chilkat.JsonObject success = json.Load(responseBody) json.EmitCompact = False System.DebugLog(json.Emit()) System.DebugLog("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": {} // } Dim id As String Dim name As String Dim desc As String Dim descData As String Dim closed As Boolean Dim idOrganization As String Dim pinned As Boolean Dim url As String Dim shortUrl As String Dim prefsPermissionLevel As String Dim prefsVoting As String Dim prefsComments As String Dim prefsInvitations As String Dim prefsSelfJoin As Boolean Dim prefsCardCovers As Boolean Dim prefsCardAging As String Dim prefsCalendarFeedEnabled As Boolean Dim prefsBackground As String Dim prefsBackgroundImage As String Dim prefsBackgroundImageScaled As String Dim prefsBackgroundTile As Boolean Dim prefsBackgroundBrightness As String Dim prefsBackgroundColor As String Dim prefsBackgroundBottomColor As String Dim prefsBackgroundTopColor As String Dim prefsCanBePublic As Boolean Dim prefsCanBeEnterprise As Boolean Dim prefsCanBeOrg As Boolean Dim prefsCanBePrivate As Boolean Dim prefsCanInvite As Boolean Dim labelNamesGreen As String Dim labelNamesYellow As String Dim labelNamesOrange As String Dim labelNamesRed As String Dim labelNamesPurple As String Dim labelNamesBlue As String Dim labelNamesSky As String Dim labelNamesLime As String Dim labelNamesPink As String Dim labelNamesBlack As String 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.