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

Unicode C++ 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

 

 

 

(Unicode C++) Trello List Member Boards

Lists the boards that the user is a member of.

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

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Win Mobile 5.0/Pocket PC 2003

Solaris C/C++

FreeBSD C/C++

OpenBSD C/C++

MinGW C/C++

#include <CkJsonObjectW.h>
#include <CkOAuth1W.h>
#include <CkRestW.h>
#include <CkJsonArrayW.h>

void ChilkatSample(void)
    {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    // curl --request GET \
    //   --url 'https://api.trello.com/1/members/{member_id}/boards?filter=all&fields=all&lists=none&memberships=none&organization=false&organization_fields=displayName'

    // First get our previously obtained access token.
    CkJsonObjectW jsonToken;
    bool success = jsonToken.LoadFile(L"qa_data/tokens/trello.json");

    CkOAuth1W oauth1;
    oauth1.put_ConsumerKey(L"TRELLO_CONSUMER_KEY");
    oauth1.put_ConsumerSecret(L"TRELLO_CONSUMER_SECRET");
    oauth1.put_Token(jsonToken.stringOf(L"oauth_token"));
    oauth1.put_TokenSecret(jsonToken.stringOf(L"oauth_token_secret"));

    CkRestW 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.
    bool bAutoReconnect = true;
    success = rest.Connect(L"api.trello.com",443,true,bAutoReconnect);
    if (success != true) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    rest.SetAuthOAuth1(oauth1,false);

    rest.AddQueryParam(L"filter",L"all");
    rest.AddQueryParam(L"fields",L"all");
    rest.AddQueryParam(L"lists",L"none");
    rest.AddQueryParam(L"memberships",L"normal");
    rest.AddQueryParam(L"organization",L"false");
    rest.AddQueryParam(L"organization_fields",L"name,displayName");

    rest.AddHeader(L"Accept",L"application/json");

    const wchar_t *responseBody = rest.fullRequestNoBody(L"GET",L"/1/members/member_id/boards");
    if (rest.get_LastMethodSuccess() != true) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    // We should expect a 200 response if successful.
    if (rest.get_ResponseStatusCode() != 200) {
        wprintf(L"Request Header: \n");
        wprintf(L"%s\n",rest.lastRequestHeader());
        wprintf(L"----\n");
        wprintf(L"Response StatusCode = %d\n",rest.get_ResponseStatusCode());
        wprintf(L"Response StatusLine: %s\n",rest.responseStatusText());
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",rest.responseHeader());
        wprintf(L"%s\n",responseBody);
        return;
    }

    CkJsonArrayW jarr;
    jarr.Load(responseBody);
    jarr.put_EmitCompact(false);
    wprintf(L"%s\n",jarr.emit());
    wprintf(L"Success.\n");

    // 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

    // [
    //   {
    //     "name": "House Projects",
    //     "desc": "",
    //     "descData": null,
    //     "closed": false,
    //     "idOrganization": null,
    //     "limits": null,
    //     "pinned": null,
    //     "shortLink": "j1hkQKKS",
    //     "powerUps": [
    //     ],
    //     "dateLastActivity": null,
    //     "idTags": [
    //     ],
    //     "datePluginDisable": null,
    //     "creationMethod": null,
    //     "ixUpdate": null,
    //     "id": "5cc5fe862106bb8e05aa41e7",
    //     "starred": false,
    //     "url": "https://trello.com/b/j1hkQKKS/house-projects",
    //     "prefs": {
    //       "permissionLevel": "private",
    //       "voting": "disabled",
    //       "comments": "members",
    //       "invitations": "members",
    //       "selfJoin": false,
    //       "cardCovers": true,
    //       "cardAging": "regular",
    //       "calendarFeedEnabled": false,
    //       "background": "5cc344f6ba4cdc5f5cfc7d81",
    //       "backgroundImage": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/2560x1709/4418c78f2f66d26932fef88aead2aff5/photo-1555985202-12975b0235dc",
    //       "backgroundImageScaled": [
    //         {
    //           "width": 140,
    //           "height": 93,
    //           "url": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/140x93/0aebced0ac2d8c9c4b9231b1960d28c2/photo-1555985202-12975b0235dc.jpg"
    //         },
    //  ...
    //         {
    //           "width": 2560,
    //           "height": 1709,
    //           "url": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/2560x1709/4418c78f2f66d26932fef88aead2aff5/photo-1555985202-12975b0235dc"
    //         }
    //       ],
    //       "backgroundTile": false,
    //       "backgroundBrightness": "dark",
    //       "backgroundBottomColor": "#412f23",
    //       "backgroundTopColor": "#a99d97",
    //       "canBePublic": true,
    //       "canBeEnterprise": true,
    //       "canBeOrg": true,
    //       "canBePrivate": true,
    //       "canInvite": true
    //     },
    //     "subscribed": false,
    //     "labelNames": {
    //       "green": "",
    //       "yellow": "",
    //       "orange": "",
    //       "red": "",
    //       "purple": "",
    //       "blue": "",
    //       "sky": "",
    //       "lime": "",
    //       "pink": "",
    //       "black": ""
    //     },
    //     "dateLastView": "2019-04-28T19:28:18.159Z",
    //     "shortUrl": "https://trello.com/b/j1hkQKKS",
    //     "memberships": [
    //       {
    //         "id": "5cc5fe862106bb8e05aa41e8",
    //         "idMember": "5cc5c74067d5215921ca7677",
    //         "memberType": "admin",
    //         "unconfirmed": false,
    //         "deactivated": false
    //       }
    //     ]
    //   },
    //   {
    //     "name": "Vacation Planning",
    //     "desc": "",
    //     "descData": null,
    //     "closed": false,
    //     "idOrganization": null,
    //     "limits": null,
    //     "pinned": null,
    //     "shortLink": "QqIHvQyz",
    //     "powerUps": [
    //     ],
    //     "dateLastActivity": "2019-04-28T15:32:20.134Z",
    //     "idTags": [
    //     ],
    //     "datePluginDisable": null,
    //     "creationMethod": "assisted",
    //     "ixUpdate": null,
    //     "id": "5cc5c783f5b10f8717a6b3d6",
    //     "starred": false,
    //     "url": "https://trello.com/b/QqIHvQyz/vacation-planning",
    //     "prefs": {
    //       "permissionLevel": "private",
    //       "voting": "disabled",
    //       "comments": "members",
    //       "invitations": "members",
    //       "selfJoin": true,
    //       "cardCovers": true,
    //       "cardAging": "regular",
    //       "calendarFeedEnabled": false,
    //       "background": "lime",
    //       "backgroundImage": null,
    //       "backgroundImageScaled": null,
    //       "backgroundTile": false,
    //       "backgroundBrightness": "dark",
    //       "backgroundColor": "#4BBF6B",
    //       "backgroundBottomColor": "#4BBF6B",
    //       "backgroundTopColor": "#4BBF6B",
    //       "canBePublic": true,
    //       "canBeEnterprise": true,
    //       "canBeOrg": true,
    //       "canBePrivate": true,
    //       "canInvite": true
    //     },
    //     "subscribed": false,
    //     "labelNames": {
    //       "green": "",
    //       "yellow": "",
    //       "orange": "",
    //       "red": "",
    //       "purple": "",
    //       "blue": "",
    //       "sky": "",
    //       "lime": "",
    //       "pink": "",
    //       "black": ""
    //     },
    //     "dateLastView": "2019-04-28T19:32:21.009Z",
    //     "shortUrl": "https://trello.com/b/QqIHvQyz",
    //     "memberships": [
    //       {
    //         "id": "5cc5c783f5b10f8717a6b3d7",
    //         "idMember": "5cc5c74067d5215921ca7677",
    //         "memberType": "admin",
    //         "unconfirmed": false,
    //         "deactivated": false
    //       }
    //     ]
    //   }
    // ]

    int i;
    int count_i;
    CkJsonObjectW *json = 0;
    const wchar_t *name = 0;
    const wchar_t *desc = 0;
    const wchar_t *descData = 0;
    bool closed;
    const wchar_t *idOrganization = 0;
    const wchar_t *limits = 0;
    const wchar_t *pinned = 0;
    const wchar_t *shortLink = 0;
    const wchar_t *dateLastActivity = 0;
    const wchar_t *datePluginDisable = 0;
    const wchar_t *creationMethod = 0;
    const wchar_t *ixUpdate = 0;
    const wchar_t *id = 0;
    bool starred;
    const wchar_t *url = 0;
    const wchar_t *prefsPermissionLevel = 0;
    const wchar_t *prefsVoting = 0;
    const wchar_t *prefsComments = 0;
    const wchar_t *prefsInvitations = 0;
    bool prefsSelfJoin;
    bool prefsCardCovers;
    const wchar_t *prefsCardAging = 0;
    bool prefsCalendarFeedEnabled;
    const wchar_t *prefsBackground = 0;
    const wchar_t *prefsBackgroundImage = 0;
    bool prefsBackgroundTile;
    const wchar_t *prefsBackgroundBrightness = 0;
    const wchar_t *prefsBackgroundBottomColor = 0;
    const wchar_t *prefsBackgroundTopColor = 0;
    bool prefsCanBePublic;
    bool prefsCanBeEnterprise;
    bool prefsCanBeOrg;
    bool prefsCanBePrivate;
    bool prefsCanInvite;
    bool subscribed;
    const wchar_t *labelNamesGreen = 0;
    const wchar_t *labelNamesYellow = 0;
    const wchar_t *labelNamesOrange = 0;
    const wchar_t *labelNamesRed = 0;
    const wchar_t *labelNamesPurple = 0;
    const wchar_t *labelNamesBlue = 0;
    const wchar_t *labelNamesSky = 0;
    const wchar_t *labelNamesLime = 0;
    const wchar_t *labelNamesPink = 0;
    const wchar_t *labelNamesBlack = 0;
    const wchar_t *dateLastView = 0;
    const wchar_t *shortUrl = 0;
    const wchar_t *prefsBackgroundImageScaled = 0;
    const wchar_t *prefsBackgroundColor = 0;
    int j;
    int count_j;
    int width;
    int height;
    const wchar_t *idMember = 0;
    const wchar_t *memberType = 0;
    bool unconfirmed;
    bool deactivated;

    i = 0;
    count_i = jarr.get_Size();
    while (i < count_i) {
        json = jarr.ObjectAt(i);
        name = json->stringOf(L"name");
        desc = json->stringOf(L"desc");
        descData = json->stringOf(L"descData");
        closed = json->BoolOf(L"closed");
        idOrganization = json->stringOf(L"idOrganization");
        limits = json->stringOf(L"limits");
        pinned = json->stringOf(L"pinned");
        shortLink = json->stringOf(L"shortLink");
        dateLastActivity = json->stringOf(L"dateLastActivity");
        datePluginDisable = json->stringOf(L"datePluginDisable");
        creationMethod = json->stringOf(L"creationMethod");
        ixUpdate = json->stringOf(L"ixUpdate");
        id = json->stringOf(L"id");
        starred = json->BoolOf(L"starred");
        url = json->stringOf(L"url");
        prefsPermissionLevel = json->stringOf(L"prefs.permissionLevel");
        prefsVoting = json->stringOf(L"prefs.voting");
        prefsComments = json->stringOf(L"prefs.comments");
        prefsInvitations = json->stringOf(L"prefs.invitations");
        prefsSelfJoin = json->BoolOf(L"prefs.selfJoin");
        prefsCardCovers = json->BoolOf(L"prefs.cardCovers");
        prefsCardAging = json->stringOf(L"prefs.cardAging");
        prefsCalendarFeedEnabled = json->BoolOf(L"prefs.calendarFeedEnabled");
        prefsBackground = json->stringOf(L"prefs.background");
        prefsBackgroundImage = json->stringOf(L"prefs.backgroundImage");
        prefsBackgroundTile = json->BoolOf(L"prefs.backgroundTile");
        prefsBackgroundBrightness = json->stringOf(L"prefs.backgroundBrightness");
        prefsBackgroundBottomColor = json->stringOf(L"prefs.backgroundBottomColor");
        prefsBackgroundTopColor = json->stringOf(L"prefs.backgroundTopColor");
        prefsCanBePublic = json->BoolOf(L"prefs.canBePublic");
        prefsCanBeEnterprise = json->BoolOf(L"prefs.canBeEnterprise");
        prefsCanBeOrg = json->BoolOf(L"prefs.canBeOrg");
        prefsCanBePrivate = json->BoolOf(L"prefs.canBePrivate");
        prefsCanInvite = json->BoolOf(L"prefs.canInvite");
        subscribed = json->BoolOf(L"subscribed");
        labelNamesGreen = json->stringOf(L"labelNames.green");
        labelNamesYellow = json->stringOf(L"labelNames.yellow");
        labelNamesOrange = json->stringOf(L"labelNames.orange");
        labelNamesRed = json->stringOf(L"labelNames.red");
        labelNamesPurple = json->stringOf(L"labelNames.purple");
        labelNamesBlue = json->stringOf(L"labelNames.blue");
        labelNamesSky = json->stringOf(L"labelNames.sky");
        labelNamesLime = json->stringOf(L"labelNames.lime");
        labelNamesPink = json->stringOf(L"labelNames.pink");
        labelNamesBlack = json->stringOf(L"labelNames.black");
        dateLastView = json->stringOf(L"dateLastView");
        shortUrl = json->stringOf(L"shortUrl");
        prefsBackgroundImageScaled = json->stringOf(L"prefs.backgroundImageScaled");
        prefsBackgroundColor = json->stringOf(L"prefs.backgroundColor");
        j = 0;
        count_j = json->SizeOfArray(L"powerUps");
        while (j < count_j) {
            json->put_J(j);
            // ...
            j = j + 1;
        }

        j = 0;
        count_j = json->SizeOfArray(L"idTags");
        while (j < count_j) {
            json->put_J(j);
            // ...
            j = j + 1;
        }

        j = 0;
        count_j = json->SizeOfArray(L"prefs.backgroundImageScaled");
        while (j < count_j) {
            json->put_J(j);
            width = json->IntOf(L"prefs.backgroundImageScaled[j].width");
            height = json->IntOf(L"prefs.backgroundImageScaled[j].height");
            url = json->stringOf(L"prefs.backgroundImageScaled[j].url");
            j = j + 1;
        }

        j = 0;
        count_j = json->SizeOfArray(L"memberships");
        while (j < count_j) {
            json->put_J(j);
            id = json->stringOf(L"memberships[j].id");
            idMember = json->stringOf(L"memberships[j].idMember");
            memberType = json->stringOf(L"memberships[j].memberType");
            unconfirmed = json->BoolOf(L"memberships[j].unconfirmed");
            deactivated = json->BoolOf(L"memberships[j].deactivated");
            j = j + 1;
        }

        delete json;
        i = i + 1;
    }
    }

 

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