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
(SQL Server) Trello Create New BoardCreate a new board. For more information, see https://developers.trello.com/reference#boardsid
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @iTmp0 int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) -- 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. DECLARE @jsonToken int -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jsonToken OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @success int EXEC sp_OAMethod @jsonToken, 'LoadFile', @success OUT, 'qa_data/tokens/trello.json' DECLARE @oauth1 int -- Use "Chilkat_9_5_0.OAuth1" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.OAuth1', @oauth1 OUT EXEC sp_OASetProperty @oauth1, 'ConsumerKey', 'TRELLO_CONSUMER_KEY' EXEC sp_OASetProperty @oauth1, 'ConsumerSecret', 'TRELLO_CONSUMER_SECRET' EXEC sp_OAMethod @jsonToken, 'StringOf', @sTmp0 OUT, 'oauth_token' EXEC sp_OASetProperty @oauth1, 'Token', @sTmp0 EXEC sp_OAMethod @jsonToken, 'StringOf', @sTmp0 OUT, 'oauth_token_secret' EXEC sp_OASetProperty @oauth1, 'TokenSecret', @sTmp0 DECLARE @rest int -- Use "Chilkat_9_5_0.Rest" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Rest', @rest OUT -- 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. DECLARE @bAutoReconnect int SELECT @bAutoReconnect = 1 EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'api.trello.com', 443, 1, @bAutoReconnect IF @success <> 1 BEGIN EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @jsonToken EXEC @hr = sp_OADestroy @oauth1 EXEC @hr = sp_OADestroy @rest RETURN END EXEC sp_OAMethod @rest, 'SetAuthOAuth1', @success OUT, @oauth1, 0 EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'name', 'Football & Rugby' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'defaultLabels', 'true' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'defaultLists', 'true' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'keepFromSource', 'none' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'prefs_permissionLevel', 'private' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'prefs_voting', 'disabled' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'prefs_comments', 'members' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'prefs_invitations', 'members' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'prefs_selfJoin', 'true' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'prefs_cardCovers', 'true' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'prefs_background', 'blue' EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'prefs_cardAging', 'regular' EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'Accept', 'application/json' DECLARE @responseBody nvarchar(4000) EXEC sp_OAMethod @rest, 'FullRequestFormUrlEncoded', @responseBody OUT, 'POST', '/1/boards' EXEC sp_OAGetProperty @rest, 'LastMethodSuccess', @iTmp0 OUT IF @iTmp0 <> 1 BEGIN EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @jsonToken EXEC @hr = sp_OADestroy @oauth1 EXEC @hr = sp_OADestroy @rest RETURN END -- We should expect a 200 response if successful. EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @iTmp0 OUT IF @iTmp0 <> 200 BEGIN PRINT 'Request Header: ' EXEC sp_OAGetProperty @rest, 'LastRequestHeader', @sTmp0 OUT PRINT @sTmp0 PRINT '----' EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @iTmp0 OUT PRINT 'Response StatusCode = ' + @iTmp0 EXEC sp_OAGetProperty @rest, 'ResponseStatusText', @sTmp0 OUT PRINT 'Response StatusLine: ' + @sTmp0 PRINT 'Response Header:' EXEC sp_OAGetProperty @rest, 'ResponseHeader', @sTmp0 OUT PRINT @sTmp0 PRINT @responseBody EXEC @hr = sp_OADestroy @jsonToken EXEC @hr = sp_OADestroy @oauth1 EXEC @hr = sp_OADestroy @rest RETURN END DECLARE @json int -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT EXEC sp_OAMethod @json, 'Load', @success OUT, @responseBody EXEC sp_OASetProperty @json, 'EmitCompact', 0 EXEC sp_OAMethod @json, 'Emit', @sTmp0 OUT PRINT @sTmp0 PRINT '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": {} -- } DECLARE @id nvarchar(4000) DECLARE @name nvarchar(4000) DECLARE @desc nvarchar(4000) DECLARE @descData nvarchar(4000) DECLARE @closed int DECLARE @idOrganization nvarchar(4000) DECLARE @pinned int DECLARE @url nvarchar(4000) DECLARE @shortUrl nvarchar(4000) DECLARE @prefsPermissionLevel nvarchar(4000) DECLARE @prefsVoting nvarchar(4000) DECLARE @prefsComments nvarchar(4000) DECLARE @prefsInvitations nvarchar(4000) DECLARE @prefsSelfJoin int DECLARE @prefsCardCovers int DECLARE @prefsCardAging nvarchar(4000) DECLARE @prefsCalendarFeedEnabled int DECLARE @prefsBackground nvarchar(4000) DECLARE @prefsBackgroundImage nvarchar(4000) DECLARE @prefsBackgroundImageScaled nvarchar(4000) DECLARE @prefsBackgroundTile int DECLARE @prefsBackgroundBrightness nvarchar(4000) DECLARE @prefsBackgroundColor nvarchar(4000) DECLARE @prefsBackgroundBottomColor nvarchar(4000) DECLARE @prefsBackgroundTopColor nvarchar(4000) DECLARE @prefsCanBePublic int DECLARE @prefsCanBeEnterprise int DECLARE @prefsCanBeOrg int DECLARE @prefsCanBePrivate int DECLARE @prefsCanInvite int DECLARE @labelNamesGreen nvarchar(4000) DECLARE @labelNamesYellow nvarchar(4000) DECLARE @labelNamesOrange nvarchar(4000) DECLARE @labelNamesRed nvarchar(4000) DECLARE @labelNamesPurple nvarchar(4000) DECLARE @labelNamesBlue nvarchar(4000) DECLARE @labelNamesSky nvarchar(4000) DECLARE @labelNamesLime nvarchar(4000) DECLARE @labelNamesPink nvarchar(4000) DECLARE @labelNamesBlack nvarchar(4000) EXEC sp_OAMethod @json, 'StringOf', @id OUT, 'id' EXEC sp_OAMethod @json, 'StringOf', @name OUT, 'name' EXEC sp_OAMethod @json, 'StringOf', @desc OUT, 'desc' EXEC sp_OAMethod @json, 'StringOf', @descData OUT, 'descData' EXEC sp_OAMethod @json, 'BoolOf', @closed OUT, 'closed' EXEC sp_OAMethod @json, 'StringOf', @idOrganization OUT, 'idOrganization' EXEC sp_OAMethod @json, 'BoolOf', @pinned OUT, 'pinned' EXEC sp_OAMethod @json, 'StringOf', @url OUT, 'url' EXEC sp_OAMethod @json, 'StringOf', @shortUrl OUT, 'shortUrl' EXEC sp_OAMethod @json, 'StringOf', @prefsPermissionLevel OUT, 'prefs.permissionLevel' EXEC sp_OAMethod @json, 'StringOf', @prefsVoting OUT, 'prefs.voting' EXEC sp_OAMethod @json, 'StringOf', @prefsComments OUT, 'prefs.comments' EXEC sp_OAMethod @json, 'StringOf', @prefsInvitations OUT, 'prefs.invitations' EXEC sp_OAMethod @json, 'BoolOf', @prefsSelfJoin OUT, 'prefs.selfJoin' EXEC sp_OAMethod @json, 'BoolOf', @prefsCardCovers OUT, 'prefs.cardCovers' EXEC sp_OAMethod @json, 'StringOf', @prefsCardAging OUT, 'prefs.cardAging' EXEC sp_OAMethod @json, 'BoolOf', @prefsCalendarFeedEnabled OUT, 'prefs.calendarFeedEnabled' EXEC sp_OAMethod @json, 'StringOf', @prefsBackground OUT, 'prefs.background' EXEC sp_OAMethod @json, 'StringOf', @prefsBackgroundImage OUT, 'prefs.backgroundImage' EXEC sp_OAMethod @json, 'StringOf', @prefsBackgroundImageScaled OUT, 'prefs.backgroundImageScaled' EXEC sp_OAMethod @json, 'BoolOf', @prefsBackgroundTile OUT, 'prefs.backgroundTile' EXEC sp_OAMethod @json, 'StringOf', @prefsBackgroundBrightness OUT, 'prefs.backgroundBrightness' EXEC sp_OAMethod @json, 'StringOf', @prefsBackgroundColor OUT, 'prefs.backgroundColor' EXEC sp_OAMethod @json, 'StringOf', @prefsBackgroundBottomColor OUT, 'prefs.backgroundBottomColor' EXEC sp_OAMethod @json, 'StringOf', @prefsBackgroundTopColor OUT, 'prefs.backgroundTopColor' EXEC sp_OAMethod @json, 'BoolOf', @prefsCanBePublic OUT, 'prefs.canBePublic' EXEC sp_OAMethod @json, 'BoolOf', @prefsCanBeEnterprise OUT, 'prefs.canBeEnterprise' EXEC sp_OAMethod @json, 'BoolOf', @prefsCanBeOrg OUT, 'prefs.canBeOrg' EXEC sp_OAMethod @json, 'BoolOf', @prefsCanBePrivate OUT, 'prefs.canBePrivate' EXEC sp_OAMethod @json, 'BoolOf', @prefsCanInvite OUT, 'prefs.canInvite' EXEC sp_OAMethod @json, 'StringOf', @labelNamesGreen OUT, 'labelNames.green' EXEC sp_OAMethod @json, 'StringOf', @labelNamesYellow OUT, 'labelNames.yellow' EXEC sp_OAMethod @json, 'StringOf', @labelNamesOrange OUT, 'labelNames.orange' EXEC sp_OAMethod @json, 'StringOf', @labelNamesRed OUT, 'labelNames.red' EXEC sp_OAMethod @json, 'StringOf', @labelNamesPurple OUT, 'labelNames.purple' EXEC sp_OAMethod @json, 'StringOf', @labelNamesBlue OUT, 'labelNames.blue' EXEC sp_OAMethod @json, 'StringOf', @labelNamesSky OUT, 'labelNames.sky' EXEC sp_OAMethod @json, 'StringOf', @labelNamesLime OUT, 'labelNames.lime' EXEC sp_OAMethod @json, 'StringOf', @labelNamesPink OUT, 'labelNames.pink' EXEC sp_OAMethod @json, 'StringOf', @labelNamesBlack OUT, 'labelNames.black' EXEC @hr = sp_OADestroy @jsonToken EXEC @hr = sp_OADestroy @oauth1 EXEC @hr = sp_OADestroy @rest EXEC @hr = sp_OADestroy @json END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.