Unicode C
Unicode C
Frame.io - Get Account ID
See more Frame.io Examples
Make a GET /me request if you don't have your Account ID on hand:Chilkat Unicode C Downloads
#include <C_CkHttpW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkJsonObjectW.h>
void ChilkatSample(void)
{
BOOL success;
HCkHttpW http;
HCkStringBuilderW sbResponseBody;
HCkJsonObjectW jResp;
int respStatusCode;
const wchar_t *v_type;
const wchar_t *account_id;
const wchar_t *bio;
const wchar_t *context;
const wchar_t *deleted_at;
const wchar_t *digest_frequency;
const wchar_t *email;
const wchar_t *email_confirm_by;
const wchar_t *email_preferences;
const wchar_t *features_seen;
const wchar_t *first_login_at;
BOOL from_google;
const wchar_t *id;
const wchar_t *image_128;
const wchar_t *image_256;
const wchar_t *image_32;
const wchar_t *image_64;
const wchar_t *inserted_at;
const wchar_t *joined_via;
const wchar_t *last_seen;
const wchar_t *location;
const wchar_t *name;
const wchar_t *next_digest_date;
const wchar_t *phone;
const wchar_t *profile_image;
const wchar_t *profile_image_original;
const wchar_t *roles;
const wchar_t *timezone_value;
const wchar_t *updated_at;
const wchar_t *upload_url;
const wchar_t *user_default_color;
const wchar_t *user_hash;
success = FALSE;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// Implements the following CURL command:
// curl \
// -H "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" \
// https://api.frame.io/v2/me
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
// Adds the "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" header.
CkHttpW_putAuthToken(http,L"<FRAME_IO_DEV_TOKEN>");
sbResponseBody = CkStringBuilderW_Create();
success = CkHttpW_QuickGetSb(http,L"https://api.frame.io/v2/me",sbResponseBody);
if (success == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
jResp = CkJsonObjectW_Create();
CkJsonObjectW_LoadSb(jResp,sbResponseBody);
CkJsonObjectW_putEmitCompact(jResp,FALSE);
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkJsonObjectW_emit(jResp));
respStatusCode = CkHttpW_getLastStatus(http);
wprintf(L"Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkHttpW_lastHeader(http));
wprintf(L"Failed.\n");
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
return;
}
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "_type": "user",
// "account_id": "b1cd046b-a3bf-4ef8-81a6-0afd74ecc455",
// "bio": null,
// "context": null,
// "deleted_at": null,
// "digest_frequency": "*/5 * * * *",
// "email": "admin@chilkatsoft.com",
// "email_confirm_by": null,
// "email_preferences": null,
// "features_seen": null,
// "first_login_at": "2020-08-18T02:20:56.732000Z",
// "from_google": false,
// "id": "34b4f98a-7cc9-4159-8f46-c7c3d837fc6f",
// "image_128": null,
// "image_256": null,
// "image_32": null,
// "image_64": null,
// "inserted_at": "2020-08-18T02:20:13.145929Z",
// "joined_via": "organic",
// "last_seen": "2020-08-18T02:20:52.852871Z",
// "location": null,
// "name": "Chilkat Software",
// "next_digest_date": "2020-08-18T02:20:13.145828Z",
// "phone": null,
// "profile_image": "https://static-assets.frame.io/app/anon.jpg",
// "profile_image_original": null,
// "roles": null,
// "timezone_value": "America/New_York",
// "updated_at": "2020-08-18T02:20:56.950455Z",
// "upload_url": "https://frameio-uploads-production.s3-accelerate.amazonaws.com/users/34b4f...cdcfe42b2e2f",
// "user_default_color": "#ff40ff",
// "user_hash": "1D39653455C86A85CA3D479C6D2ACE831211BC1B65770DF3747116DD320C3A00"
// }
// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
// See this example explaining how this memory should be used: const char * functions.
v_type = CkJsonObjectW_stringOf(jResp,L"_type");
account_id = CkJsonObjectW_stringOf(jResp,L"account_id");
bio = CkJsonObjectW_stringOf(jResp,L"bio");
context = CkJsonObjectW_stringOf(jResp,L"context");
deleted_at = CkJsonObjectW_stringOf(jResp,L"deleted_at");
digest_frequency = CkJsonObjectW_stringOf(jResp,L"digest_frequency");
email = CkJsonObjectW_stringOf(jResp,L"email");
email_confirm_by = CkJsonObjectW_stringOf(jResp,L"email_confirm_by");
email_preferences = CkJsonObjectW_stringOf(jResp,L"email_preferences");
features_seen = CkJsonObjectW_stringOf(jResp,L"features_seen");
first_login_at = CkJsonObjectW_stringOf(jResp,L"first_login_at");
from_google = CkJsonObjectW_BoolOf(jResp,L"from_google");
id = CkJsonObjectW_stringOf(jResp,L"id");
image_128 = CkJsonObjectW_stringOf(jResp,L"image_128");
image_256 = CkJsonObjectW_stringOf(jResp,L"image_256");
image_32 = CkJsonObjectW_stringOf(jResp,L"image_32");
image_64 = CkJsonObjectW_stringOf(jResp,L"image_64");
inserted_at = CkJsonObjectW_stringOf(jResp,L"inserted_at");
joined_via = CkJsonObjectW_stringOf(jResp,L"joined_via");
last_seen = CkJsonObjectW_stringOf(jResp,L"last_seen");
location = CkJsonObjectW_stringOf(jResp,L"location");
name = CkJsonObjectW_stringOf(jResp,L"name");
next_digest_date = CkJsonObjectW_stringOf(jResp,L"next_digest_date");
phone = CkJsonObjectW_stringOf(jResp,L"phone");
profile_image = CkJsonObjectW_stringOf(jResp,L"profile_image");
profile_image_original = CkJsonObjectW_stringOf(jResp,L"profile_image_original");
roles = CkJsonObjectW_stringOf(jResp,L"roles");
timezone_value = CkJsonObjectW_stringOf(jResp,L"timezone_value");
updated_at = CkJsonObjectW_stringOf(jResp,L"updated_at");
upload_url = CkJsonObjectW_stringOf(jResp,L"upload_url");
user_default_color = CkJsonObjectW_stringOf(jResp,L"user_default_color");
user_hash = CkJsonObjectW_stringOf(jResp,L"user_hash");
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
}