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
(Lianja) 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. loJsonToken = createobject("CkJsonObject") llSuccess = loJsonToken.LoadFile("qa_data/tokens/trello.json") loOauth1 = createobject("CkOAuth1") loOauth1.ConsumerKey = "TRELLO_CONSUMER_KEY" loOauth1.ConsumerSecret = "TRELLO_CONSUMER_SECRET" loOauth1.Token = loJsonToken.StringOf("oauth_token") loOauth1.TokenSecret = loJsonToken.StringOf("oauth_token_secret") loRest = createobject("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. llBAutoReconnect = .T. llSuccess = loRest.Connect("api.trello.com",443,.T.,llBAutoReconnect) if (llSuccess <> .T.) then ? loRest.LastErrorText release loJsonToken release loOauth1 release loRest return endif loRest.SetAuthOAuth1(loOauth1,.F.) loRest.AddQueryParam("name","Football & Rugby") loRest.AddQueryParam("defaultLabels","true") loRest.AddQueryParam("defaultLists","true") loRest.AddQueryParam("keepFromSource","none") loRest.AddQueryParam("prefs_permissionLevel","private") loRest.AddQueryParam("prefs_voting","disabled") loRest.AddQueryParam("prefs_comments","members") loRest.AddQueryParam("prefs_invitations","members") loRest.AddQueryParam("prefs_selfJoin","true") loRest.AddQueryParam("prefs_cardCovers","true") loRest.AddQueryParam("prefs_background","blue") loRest.AddQueryParam("prefs_cardAging","regular") loRest.AddHeader("Accept","application/json") lcResponseBody = loRest.FullRequestFormUrlEncoded("POST","/1/boards") if (loRest.LastMethodSuccess <> .T.) then ? loRest.LastErrorText release loJsonToken release loOauth1 release loRest return endif // We should expect a 200 response if successful. if (loRest.ResponseStatusCode <> 200) then ? "Request Header: " ? loRest.LastRequestHeader ? "----" ? "Response StatusCode = " + str(loRest.ResponseStatusCode) ? "Response StatusLine: " + loRest.ResponseStatusText ? "Response Header:" ? loRest.ResponseHeader ? lcResponseBody release loJsonToken release loOauth1 release loRest return endif loJson = createobject("CkJsonObject") loJson.Load(lcResponseBody) loJson.EmitCompact = .F. ? loJson.Emit() ? "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": {} // } lcId = loJson.StringOf("id") lcName = loJson.StringOf("name") lcDesc = loJson.StringOf("desc") lcDescData = loJson.StringOf("descData") llClosed = loJson.BoolOf("closed") lcIdOrganization = loJson.StringOf("idOrganization") llPinned = loJson.BoolOf("pinned") lcUrl = loJson.StringOf("url") lcShortUrl = loJson.StringOf("shortUrl") lcPrefsPermissionLevel = loJson.StringOf("prefs.permissionLevel") lcPrefsVoting = loJson.StringOf("prefs.voting") lcPrefsComments = loJson.StringOf("prefs.comments") lcPrefsInvitations = loJson.StringOf("prefs.invitations") llPrefsSelfJoin = loJson.BoolOf("prefs.selfJoin") llPrefsCardCovers = loJson.BoolOf("prefs.cardCovers") lcPrefsCardAging = loJson.StringOf("prefs.cardAging") llPrefsCalendarFeedEnabled = loJson.BoolOf("prefs.calendarFeedEnabled") lcPrefsBackground = loJson.StringOf("prefs.background") lcPrefsBackgroundImage = loJson.StringOf("prefs.backgroundImage") lcPrefsBackgroundImageScaled = loJson.StringOf("prefs.backgroundImageScaled") llPrefsBackgroundTile = loJson.BoolOf("prefs.backgroundTile") lcPrefsBackgroundBrightness = loJson.StringOf("prefs.backgroundBrightness") lcPrefsBackgroundColor = loJson.StringOf("prefs.backgroundColor") lcPrefsBackgroundBottomColor = loJson.StringOf("prefs.backgroundBottomColor") lcPrefsBackgroundTopColor = loJson.StringOf("prefs.backgroundTopColor") llPrefsCanBePublic = loJson.BoolOf("prefs.canBePublic") llPrefsCanBeEnterprise = loJson.BoolOf("prefs.canBeEnterprise") llPrefsCanBeOrg = loJson.BoolOf("prefs.canBeOrg") llPrefsCanBePrivate = loJson.BoolOf("prefs.canBePrivate") llPrefsCanInvite = loJson.BoolOf("prefs.canInvite") lcLabelNamesGreen = loJson.StringOf("labelNames.green") lcLabelNamesYellow = loJson.StringOf("labelNames.yellow") lcLabelNamesOrange = loJson.StringOf("labelNames.orange") lcLabelNamesRed = loJson.StringOf("labelNames.red") lcLabelNamesPurple = loJson.StringOf("labelNames.purple") lcLabelNamesBlue = loJson.StringOf("labelNames.blue") lcLabelNamesSky = loJson.StringOf("labelNames.sky") lcLabelNamesLime = loJson.StringOf("labelNames.lime") lcLabelNamesPink = loJson.StringOf("labelNames.pink") lcLabelNamesBlack = loJson.StringOf("labelNames.black") release loJsonToken release loOauth1 release loRest release loJson |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.