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
(Visual FoxPro) Trello Create New BoardCreate a new board. For more information, see https://developers.trello.com/reference#boardsid
LOCAL loJsonToken LOCAL lnSuccess LOCAL loOauth1 LOCAL loRest LOCAL lnBAutoReconnect LOCAL lcResponseBody LOCAL loJson LOCAL lcId LOCAL lcName LOCAL lcDesc LOCAL lcDescData LOCAL lnClosed LOCAL lcIdOrganization LOCAL lnPinned LOCAL lcUrl LOCAL lcShortUrl LOCAL lcPrefsPermissionLevel LOCAL lcPrefsVoting LOCAL lcPrefsComments LOCAL lcPrefsInvitations LOCAL lnPrefsSelfJoin LOCAL lnPrefsCardCovers LOCAL lcPrefsCardAging LOCAL lnPrefsCalendarFeedEnabled LOCAL lcPrefsBackground LOCAL lcPrefsBackgroundImage LOCAL lcPrefsBackgroundImageScaled LOCAL lnPrefsBackgroundTile LOCAL lcPrefsBackgroundBrightness LOCAL lcPrefsBackgroundColor LOCAL lcPrefsBackgroundBottomColor LOCAL lcPrefsBackgroundTopColor LOCAL lnPrefsCanBePublic LOCAL lnPrefsCanBeEnterprise LOCAL lnPrefsCanBeOrg LOCAL lnPrefsCanBePrivate LOCAL lnPrefsCanInvite LOCAL lcLabelNamesGreen LOCAL lcLabelNamesYellow LOCAL lcLabelNamesOrange LOCAL lcLabelNamesRed LOCAL lcLabelNamesPurple LOCAL lcLabelNamesBlue LOCAL lcLabelNamesSky LOCAL lcLabelNamesLime LOCAL lcLabelNamesPink LOCAL lcLabelNamesBlack * 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. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJsonToken = CreateObject('Chilkat.JsonObject') lnSuccess = loJsonToken.LoadFile("qa_data/tokens/trello.json") * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.OAuth1') loOauth1 = CreateObject('Chilkat.OAuth1') loOauth1.ConsumerKey = "TRELLO_CONSUMER_KEY" loOauth1.ConsumerSecret = "TRELLO_CONSUMER_SECRET" loOauth1.Token = loJsonToken.StringOf("oauth_token") loOauth1.TokenSecret = loJsonToken.StringOf("oauth_token_secret") * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Rest') loRest = CreateObject('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. lnBAutoReconnect = 1 lnSuccess = loRest.Connect("api.trello.com",443,1,lnBAutoReconnect) IF (lnSuccess <> 1) THEN ? loRest.LastErrorText RELEASE loJsonToken RELEASE loOauth1 RELEASE loRest CANCEL ENDIF loRest.SetAuthOAuth1(loOauth1,0) 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 <> 1) THEN ? loRest.LastErrorText RELEASE loJsonToken RELEASE loOauth1 RELEASE loRest CANCEL 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 CANCEL ENDIF * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') loJson.Load(lcResponseBody) loJson.EmitCompact = 0 ? 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") lnClosed = loJson.BoolOf("closed") lcIdOrganization = loJson.StringOf("idOrganization") lnPinned = 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") lnPrefsSelfJoin = loJson.BoolOf("prefs.selfJoin") lnPrefsCardCovers = loJson.BoolOf("prefs.cardCovers") lcPrefsCardAging = loJson.StringOf("prefs.cardAging") lnPrefsCalendarFeedEnabled = loJson.BoolOf("prefs.calendarFeedEnabled") lcPrefsBackground = loJson.StringOf("prefs.background") lcPrefsBackgroundImage = loJson.StringOf("prefs.backgroundImage") lcPrefsBackgroundImageScaled = loJson.StringOf("prefs.backgroundImageScaled") lnPrefsBackgroundTile = loJson.BoolOf("prefs.backgroundTile") lcPrefsBackgroundBrightness = loJson.StringOf("prefs.backgroundBrightness") lcPrefsBackgroundColor = loJson.StringOf("prefs.backgroundColor") lcPrefsBackgroundBottomColor = loJson.StringOf("prefs.backgroundBottomColor") lcPrefsBackgroundTopColor = loJson.StringOf("prefs.backgroundTopColor") lnPrefsCanBePublic = loJson.BoolOf("prefs.canBePublic") lnPrefsCanBeEnterprise = loJson.BoolOf("prefs.canBeEnterprise") lnPrefsCanBeOrg = loJson.BoolOf("prefs.canBeOrg") lnPrefsCanBePrivate = loJson.BoolOf("prefs.canBePrivate") lnPrefsCanInvite = 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.