Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Web API Examples

Primary Categories

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shippo
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(DataFlex) Trello Create New Board

Create a new board.

For more information, see https://developers.trello.com/reference#boardsid

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
Token    Handle hoJsonToken
    Boolean iSuccess
    Variant vOauth1
    Handle hoOauth1
    Handle hoRest
    Boolean iBAutoReconnect
    String sResponseBody
    Handle hoJson
    String sId
    String sName
    String sDesc
    String sDescData
    Boolean iClosed
    String sIdOrganization
    Boolean iPinned
    String sUrl
    String sShortUrl
    String sPrefsPermissionLevel
    String sPrefsVoting
    String sPrefsComments
    String sPrefsInvitations
    Boolean iPrefsSelfJoin
    Boolean iPrefsCardCovers
    String sPrefsCardAging
    Boolean iPrefsCalendarFeedEnabled
    String sPrefsBackground
    String sPrefsBackgroundImage
    String sPrefsBackgroundImageScaled
    Boolean iPrefsBackgroundTile
    String sPrefsBackgroundBrightness
    String sPrefsBackgroundColor
    String sPrefsBackgroundBottomColor
    String sPrefsBackgroundTopColor
    Boolean iPrefsCanBePublic
    Boolean iPrefsCanBeEnterprise
    Boolean iPrefsCanBeOrg
    Boolean iPrefsCanBePrivate
    Boolean iPrefsCanInvite
    String sLabelNamesGreen
    String sLabelNamesYellow
    String sLabelNamesOrange
    String sLabelNamesRed
    String sLabelNamesPurple
    String sLabelNamesBlue
    String sLabelNamesSky
    String sLabelNamesLime
    String sLabelNamesPink
    String sLabelNamesBlack
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    // 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.
    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken
    If (Not(IsComObjectCreated(hoJsonToken))) Begin
        Send CreateComObject of hoJsonToken
    End
    Get ComLoadFile Of hoJsonToken "qa_data/tokens/trello.json" To iSuccess

    Get Create (RefClass(cComChilkatOAuth1)) To hoOauth1
    If (Not(IsComObjectCreated(hoOauth1))) Begin
        Send CreateComObject of hoOauth1
    End
    Set ComConsumerKey Of hoOauth1 To "TRELLO_CONSUMER_KEY"
    Set ComConsumerSecret Of hoOauth1 To "TRELLO_CONSUMER_SECRET"
    Get ComStringOf Of hoJsonToken "oauth_token" To sTemp1
    Set ComToken Of hoOauth1 To sTemp1
    Get ComStringOf Of hoJsonToken "oauth_token_secret" To sTemp1
    Set ComTokenSecret Of hoOauth1 To sTemp1

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End

    // 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.
    Move True To iBAutoReconnect
    Get ComConnect Of hoRest "api.trello.com" 443 True iBAutoReconnect To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get pvComObject of hoOauth1 to vOauth1
    Get ComSetAuthOAuth1 Of hoRest vOauth1 False To iSuccess

    Get ComAddQueryParam Of hoRest "name" "Football & Rugby" To iSuccess
    Get ComAddQueryParam Of hoRest "defaultLabels" "true" To iSuccess
    Get ComAddQueryParam Of hoRest "defaultLists" "true" To iSuccess
    Get ComAddQueryParam Of hoRest "keepFromSource" "none" To iSuccess
    Get ComAddQueryParam Of hoRest "prefs_permissionLevel" "private" To iSuccess
    Get ComAddQueryParam Of hoRest "prefs_voting" "disabled" To iSuccess
    Get ComAddQueryParam Of hoRest "prefs_comments" "members" To iSuccess
    Get ComAddQueryParam Of hoRest "prefs_invitations" "members" To iSuccess
    Get ComAddQueryParam Of hoRest "prefs_selfJoin" "true" To iSuccess
    Get ComAddQueryParam Of hoRest "prefs_cardCovers" "true" To iSuccess
    Get ComAddQueryParam Of hoRest "prefs_background" "blue" To iSuccess
    Get ComAddQueryParam Of hoRest "prefs_cardAging" "regular" To iSuccess

    Get ComAddHeader Of hoRest "Accept" "application/json" To iSuccess

    Get ComFullRequestFormUrlEncoded Of hoRest "POST" "/1/boards" To sResponseBody
    Get ComLastMethodSuccess Of hoRest To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // We should expect a 200 response if successful.
    Get ComResponseStatusCode Of hoRest To iTemp1
    If (iTemp1 <> 200) Begin
        Showln "Request Header: "
        Get ComLastRequestHeader Of hoRest To sTemp1
        Showln sTemp1
        Showln "----"
        Get ComResponseStatusCode Of hoRest To iTemp1
        Showln "Response StatusCode = " iTemp1
        Get ComResponseStatusText Of hoRest To sTemp1
        Showln "Response StatusLine: " sTemp1
        Showln "Response Header:"
        Get ComResponseHeader Of hoRest To sTemp1
        Showln sTemp1
        Showln sResponseBody
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComLoad Of hoJson sResponseBody To iSuccess
    Set ComEmitCompact Of hoJson To False
    Get ComEmit Of hoJson To sTemp1
    Showln sTemp1
    Showln "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": {}
    // }

    Get ComStringOf Of hoJson "id" To sId
    Get ComStringOf Of hoJson "name" To sName
    Get ComStringOf Of hoJson "desc" To sDesc
    Get ComStringOf Of hoJson "descData" To sDescData
    Get ComBoolOf Of hoJson "closed" To iClosed
    Get ComStringOf Of hoJson "idOrganization" To sIdOrganization
    Get ComBoolOf Of hoJson "pinned" To iPinned
    Get ComStringOf Of hoJson "url" To sUrl
    Get ComStringOf Of hoJson "shortUrl" To sShortUrl
    Get ComStringOf Of hoJson "prefs.permissionLevel" To sPrefsPermissionLevel
    Get ComStringOf Of hoJson "prefs.voting" To sPrefsVoting
    Get ComStringOf Of hoJson "prefs.comments" To sPrefsComments
    Get ComStringOf Of hoJson "prefs.invitations" To sPrefsInvitations
    Get ComBoolOf Of hoJson "prefs.selfJoin" To iPrefsSelfJoin
    Get ComBoolOf Of hoJson "prefs.cardCovers" To iPrefsCardCovers
    Get ComStringOf Of hoJson "prefs.cardAging" To sPrefsCardAging
    Get ComBoolOf Of hoJson "prefs.calendarFeedEnabled" To iPrefsCalendarFeedEnabled
    Get ComStringOf Of hoJson "prefs.background" To sPrefsBackground
    Get ComStringOf Of hoJson "prefs.backgroundImage" To sPrefsBackgroundImage
    Get ComStringOf Of hoJson "prefs.backgroundImageScaled" To sPrefsBackgroundImageScaled
    Get ComBoolOf Of hoJson "prefs.backgroundTile" To iPrefsBackgroundTile
    Get ComStringOf Of hoJson "prefs.backgroundBrightness" To sPrefsBackgroundBrightness
    Get ComStringOf Of hoJson "prefs.backgroundColor" To sPrefsBackgroundColor
    Get ComStringOf Of hoJson "prefs.backgroundBottomColor" To sPrefsBackgroundBottomColor
    Get ComStringOf Of hoJson "prefs.backgroundTopColor" To sPrefsBackgroundTopColor
    Get ComBoolOf Of hoJson "prefs.canBePublic" To iPrefsCanBePublic
    Get ComBoolOf Of hoJson "prefs.canBeEnterprise" To iPrefsCanBeEnterprise
    Get ComBoolOf Of hoJson "prefs.canBeOrg" To iPrefsCanBeOrg
    Get ComBoolOf Of hoJson "prefs.canBePrivate" To iPrefsCanBePrivate
    Get ComBoolOf Of hoJson "prefs.canInvite" To iPrefsCanInvite
    Get ComStringOf Of hoJson "labelNames.green" To sLabelNamesGreen
    Get ComStringOf Of hoJson "labelNames.yellow" To sLabelNamesYellow
    Get ComStringOf Of hoJson "labelNames.orange" To sLabelNamesOrange
    Get ComStringOf Of hoJson "labelNames.red" To sLabelNamesRed
    Get ComStringOf Of hoJson "labelNames.purple" To sLabelNamesPurple
    Get ComStringOf Of hoJson "labelNames.blue" To sLabelNamesBlue
    Get ComStringOf Of hoJson "labelNames.sky" To sLabelNamesSky
    Get ComStringOf Of hoJson "labelNames.lime" To sLabelNamesLime
    Get ComStringOf Of hoJson "labelNames.pink" To sLabelNamesPink
    Get ComStringOf Of hoJson "labelNames.black" To sLabelNamesBlack


End_Procedure

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.