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
(Go) 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. jsonToken := chilkat.NewJsonObject() success := jsonToken.LoadFile("qa_data/tokens/trello.json") oauth1 := chilkat.NewOAuth1() oauth1.SetConsumerKey("TRELLO_CONSUMER_KEY") oauth1.SetConsumerSecret("TRELLO_CONSUMER_SECRET") oauth1.SetToken(jsonToken.StringOf("oauth_token")) oauth1.SetTokenSecret(jsonToken.StringOf("oauth_token_secret")) rest := chilkat.NewRest() // 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 { fmt.Println(rest.LastErrorText()) jsonToken.DisposeJsonObject() oauth1.DisposeOAuth1() rest.DisposeRest() return } 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.LastMethodSuccess() != true { fmt.Println(rest.LastErrorText()) jsonToken.DisposeJsonObject() oauth1.DisposeOAuth1() rest.DisposeRest() return } // We should expect a 200 response if successful. if rest.ResponseStatusCode() != 200 { fmt.Println("Request Header: ") fmt.Println(rest.LastRequestHeader()) fmt.Println("----") fmt.Println("Response StatusCode = ", rest.ResponseStatusCode()) fmt.Println("Response StatusLine: ", rest.ResponseStatusText()) fmt.Println("Response Header:") fmt.Println(rest.ResponseHeader()) fmt.Println(*responseBody) jsonToken.DisposeJsonObject() oauth1.DisposeOAuth1() rest.DisposeRest() return } json := chilkat.NewJsonObject() json.Load(*responseBody) json.SetEmitCompact(false) fmt.Println(*json.Emit()) fmt.Println("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": {} // } var id *string = new(string) var name *string = new(string) var desc *string = new(string) var descData *string = new(string) var closed bool var idOrganization *string = new(string) var pinned bool var url *string = new(string) var shortUrl *string = new(string) var prefsPermissionLevel *string = new(string) var prefsVoting *string = new(string) var prefsComments *string = new(string) var prefsInvitations *string = new(string) var prefsSelfJoin bool var prefsCardCovers bool var prefsCardAging *string = new(string) var prefsCalendarFeedEnabled bool var prefsBackground *string = new(string) var prefsBackgroundImage *string = new(string) var prefsBackgroundImageScaled *string = new(string) var prefsBackgroundTile bool var prefsBackgroundBrightness *string = new(string) var prefsBackgroundColor *string = new(string) var prefsBackgroundBottomColor *string = new(string) var prefsBackgroundTopColor *string = new(string) var prefsCanBePublic bool var prefsCanBeEnterprise bool var prefsCanBeOrg bool var prefsCanBePrivate bool var prefsCanInvite bool var labelNamesGreen *string = new(string) var labelNamesYellow *string = new(string) var labelNamesOrange *string = new(string) var labelNamesRed *string = new(string) var labelNamesPurple *string = new(string) var labelNamesBlue *string = new(string) var labelNamesSky *string = new(string) var labelNamesLime *string = new(string) var labelNamesPink *string = new(string) var labelNamesBlack *string = new(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") jsonToken.DisposeJsonObject() oauth1.DisposeOAuth1() rest.DisposeRest() json.DisposeJsonObject() |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.