Unicode C
Unicode C
Trello List Member Boards
See more Trello Examples
Lists the boards that the user is a member of.For more information, see https://developers.trello.com/reference#membersidboards
Chilkat Unicode C Downloads
#include <C_CkJsonObjectW.h>
#include <C_CkOAuth1W.h>
#include <C_CkRestW.h>
#include <C_CkJsonArrayW.h>
void ChilkatSample(void)
{
BOOL success;
HCkJsonObjectW jsonToken;
HCkOAuth1W oauth1;
HCkRestW rest;
BOOL bAutoReconnect;
const wchar_t *responseBody;
HCkJsonArrayW jarr;
int i;
int count_i;
HCkJsonObjectW json;
const wchar_t *name;
const wchar_t *desc;
const wchar_t *descData;
BOOL closed;
const wchar_t *idOrganization;
const wchar_t *limits;
const wchar_t *pinned;
const wchar_t *shortLink;
const wchar_t *dateLastActivity;
const wchar_t *datePluginDisable;
const wchar_t *creationMethod;
const wchar_t *ixUpdate;
const wchar_t *id;
BOOL starred;
const wchar_t *url;
const wchar_t *prefsPermissionLevel;
const wchar_t *prefsVoting;
const wchar_t *prefsComments;
const wchar_t *prefsInvitations;
BOOL prefsSelfJoin;
BOOL prefsCardCovers;
const wchar_t *prefsCardAging;
BOOL prefsCalendarFeedEnabled;
const wchar_t *prefsBackground;
const wchar_t *prefsBackgroundImage;
BOOL prefsBackgroundTile;
const wchar_t *prefsBackgroundBrightness;
const wchar_t *prefsBackgroundBottomColor;
const wchar_t *prefsBackgroundTopColor;
BOOL prefsCanBePublic;
BOOL prefsCanBeEnterprise;
BOOL prefsCanBeOrg;
BOOL prefsCanBePrivate;
BOOL prefsCanInvite;
BOOL subscribed;
const wchar_t *labelNamesGreen;
const wchar_t *labelNamesYellow;
const wchar_t *labelNamesOrange;
const wchar_t *labelNamesRed;
const wchar_t *labelNamesPurple;
const wchar_t *labelNamesBlue;
const wchar_t *labelNamesSky;
const wchar_t *labelNamesLime;
const wchar_t *labelNamesPink;
const wchar_t *labelNamesBlack;
const wchar_t *dateLastView;
const wchar_t *shortUrl;
const wchar_t *prefsBackgroundImageScaled;
const wchar_t *prefsBackgroundColor;
int j;
int count_j;
int width;
int height;
const wchar_t *idMember;
const wchar_t *memberType;
BOOL unconfirmed;
BOOL deactivated;
success = FALSE;
// 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.
jsonToken = CkJsonObjectW_Create();
success = CkJsonObjectW_LoadFile(jsonToken,L"qa_data/tokens/trello.json");
oauth1 = CkOAuth1W_Create();
CkOAuth1W_putConsumerKey(oauth1,L"TRELLO_CONSUMER_KEY");
CkOAuth1W_putConsumerSecret(oauth1,L"TRELLO_CONSUMER_SECRET");
CkOAuth1W_putToken(oauth1,CkJsonObjectW_stringOf(jsonToken,L"oauth_token"));
CkOAuth1W_putTokenSecret(oauth1,CkJsonObjectW_stringOf(jsonToken,L"oauth_token_secret"));
rest = CkRestW_Create();
// 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.
bAutoReconnect = TRUE;
success = CkRestW_Connect(rest,L"api.trello.com",443,TRUE,bAutoReconnect);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkJsonObjectW_Dispose(jsonToken);
CkOAuth1W_Dispose(oauth1);
CkRestW_Dispose(rest);
return;
}
CkRestW_SetAuthOAuth1(rest,oauth1,FALSE);
CkRestW_AddQueryParam(rest,L"filter",L"all");
CkRestW_AddQueryParam(rest,L"fields",L"all");
CkRestW_AddQueryParam(rest,L"lists",L"none");
CkRestW_AddQueryParam(rest,L"memberships",L"normal");
CkRestW_AddQueryParam(rest,L"organization",L"false");
CkRestW_AddQueryParam(rest,L"organization_fields",L"name,displayName");
CkRestW_AddHeader(rest,L"Accept",L"application/json");
responseBody = CkRestW_fullRequestNoBody(rest,L"GET",L"/1/members/member_id/boards");
if (CkRestW_getLastMethodSuccess(rest) != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkJsonObjectW_Dispose(jsonToken);
CkOAuth1W_Dispose(oauth1);
CkRestW_Dispose(rest);
return;
}
// We should expect a 200 response if successful.
if (CkRestW_getResponseStatusCode(rest) != 200) {
wprintf(L"Request Header: \n");
wprintf(L"%s\n",CkRestW_lastRequestHeader(rest));
wprintf(L"----\n");
wprintf(L"Response StatusCode = %d\n",CkRestW_getResponseStatusCode(rest));
wprintf(L"Response StatusLine: %s\n",CkRestW_responseStatusText(rest));
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkRestW_responseHeader(rest));
wprintf(L"%s\n",responseBody);
CkJsonObjectW_Dispose(jsonToken);
CkOAuth1W_Dispose(oauth1);
CkRestW_Dispose(rest);
return;
}
jarr = CkJsonArrayW_Create();
CkJsonArrayW_Load(jarr,responseBody);
CkJsonArrayW_putEmitCompact(jarr,FALSE);
wprintf(L"%s\n",CkJsonArrayW_emit(jarr));
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
// }
// ]
// }
// ]
i = 0;
count_i = CkJsonArrayW_getSize(jarr);
while (i < count_i) {
json = CkJsonArrayW_ObjectAt(jarr,i);
name = CkJsonObjectW_stringOf(json,L"name");
desc = CkJsonObjectW_stringOf(json,L"desc");
descData = CkJsonObjectW_stringOf(json,L"descData");
closed = CkJsonObjectW_BoolOf(json,L"closed");
idOrganization = CkJsonObjectW_stringOf(json,L"idOrganization");
limits = CkJsonObjectW_stringOf(json,L"limits");
pinned = CkJsonObjectW_stringOf(json,L"pinned");
shortLink = CkJsonObjectW_stringOf(json,L"shortLink");
dateLastActivity = CkJsonObjectW_stringOf(json,L"dateLastActivity");
datePluginDisable = CkJsonObjectW_stringOf(json,L"datePluginDisable");
creationMethod = CkJsonObjectW_stringOf(json,L"creationMethod");
ixUpdate = CkJsonObjectW_stringOf(json,L"ixUpdate");
id = CkJsonObjectW_stringOf(json,L"id");
starred = CkJsonObjectW_BoolOf(json,L"starred");
url = CkJsonObjectW_stringOf(json,L"url");
prefsPermissionLevel = CkJsonObjectW_stringOf(json,L"prefs.permissionLevel");
prefsVoting = CkJsonObjectW_stringOf(json,L"prefs.voting");
prefsComments = CkJsonObjectW_stringOf(json,L"prefs.comments");
prefsInvitations = CkJsonObjectW_stringOf(json,L"prefs.invitations");
prefsSelfJoin = CkJsonObjectW_BoolOf(json,L"prefs.selfJoin");
prefsCardCovers = CkJsonObjectW_BoolOf(json,L"prefs.cardCovers");
prefsCardAging = CkJsonObjectW_stringOf(json,L"prefs.cardAging");
prefsCalendarFeedEnabled = CkJsonObjectW_BoolOf(json,L"prefs.calendarFeedEnabled");
prefsBackground = CkJsonObjectW_stringOf(json,L"prefs.background");
prefsBackgroundImage = CkJsonObjectW_stringOf(json,L"prefs.backgroundImage");
prefsBackgroundTile = CkJsonObjectW_BoolOf(json,L"prefs.backgroundTile");
prefsBackgroundBrightness = CkJsonObjectW_stringOf(json,L"prefs.backgroundBrightness");
prefsBackgroundBottomColor = CkJsonObjectW_stringOf(json,L"prefs.backgroundBottomColor");
prefsBackgroundTopColor = CkJsonObjectW_stringOf(json,L"prefs.backgroundTopColor");
prefsCanBePublic = CkJsonObjectW_BoolOf(json,L"prefs.canBePublic");
prefsCanBeEnterprise = CkJsonObjectW_BoolOf(json,L"prefs.canBeEnterprise");
prefsCanBeOrg = CkJsonObjectW_BoolOf(json,L"prefs.canBeOrg");
prefsCanBePrivate = CkJsonObjectW_BoolOf(json,L"prefs.canBePrivate");
prefsCanInvite = CkJsonObjectW_BoolOf(json,L"prefs.canInvite");
subscribed = CkJsonObjectW_BoolOf(json,L"subscribed");
labelNamesGreen = CkJsonObjectW_stringOf(json,L"labelNames.green");
labelNamesYellow = CkJsonObjectW_stringOf(json,L"labelNames.yellow");
labelNamesOrange = CkJsonObjectW_stringOf(json,L"labelNames.orange");
labelNamesRed = CkJsonObjectW_stringOf(json,L"labelNames.red");
labelNamesPurple = CkJsonObjectW_stringOf(json,L"labelNames.purple");
labelNamesBlue = CkJsonObjectW_stringOf(json,L"labelNames.blue");
labelNamesSky = CkJsonObjectW_stringOf(json,L"labelNames.sky");
labelNamesLime = CkJsonObjectW_stringOf(json,L"labelNames.lime");
labelNamesPink = CkJsonObjectW_stringOf(json,L"labelNames.pink");
labelNamesBlack = CkJsonObjectW_stringOf(json,L"labelNames.black");
dateLastView = CkJsonObjectW_stringOf(json,L"dateLastView");
shortUrl = CkJsonObjectW_stringOf(json,L"shortUrl");
prefsBackgroundImageScaled = CkJsonObjectW_stringOf(json,L"prefs.backgroundImageScaled");
prefsBackgroundColor = CkJsonObjectW_stringOf(json,L"prefs.backgroundColor");
j = 0;
count_j = CkJsonObjectW_SizeOfArray(json,L"powerUps");
while (j < count_j) {
CkJsonObjectW_putJ(json,j);
// ...
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(json,L"idTags");
while (j < count_j) {
CkJsonObjectW_putJ(json,j);
// ...
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(json,L"prefs.backgroundImageScaled");
while (j < count_j) {
CkJsonObjectW_putJ(json,j);
width = CkJsonObjectW_IntOf(json,L"prefs.backgroundImageScaled[j].width");
height = CkJsonObjectW_IntOf(json,L"prefs.backgroundImageScaled[j].height");
url = CkJsonObjectW_stringOf(json,L"prefs.backgroundImageScaled[j].url");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(json,L"memberships");
while (j < count_j) {
CkJsonObjectW_putJ(json,j);
id = CkJsonObjectW_stringOf(json,L"memberships[j].id");
idMember = CkJsonObjectW_stringOf(json,L"memberships[j].idMember");
memberType = CkJsonObjectW_stringOf(json,L"memberships[j].memberType");
unconfirmed = CkJsonObjectW_BoolOf(json,L"memberships[j].unconfirmed");
deactivated = CkJsonObjectW_BoolOf(json,L"memberships[j].deactivated");
j = j + 1;
}
CkJsonObjectW_Dispose(json);
i = i + 1;
}
CkJsonObjectW_Dispose(jsonToken);
CkOAuth1W_Dispose(oauth1);
CkRestW_Dispose(rest);
CkJsonArrayW_Dispose(jarr);
}