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
(Unicode C++) Frame.io - Get Account IDMake a GET /me request if you don't have your Account ID on hand: For more information, see https://docs.frame.io/docs/root-asset-ids
#include <CkHttpW.h> #include <CkStringBuilderW.h> #include <CkJsonObjectW.h> void ChilkatSample(void) { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttpW http; bool success; // 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. http.put_AuthToken(L"<FRAME_IO_DEV_TOKEN>"); CkStringBuilderW sbResponseBody; success = http.QuickGetSb(L"https://api.frame.io/v2/me",sbResponseBody); if (success == false) { wprintf(L"%s\n",http.lastErrorText()); return; } CkJsonObjectW jResp; jResp.LoadSb(sbResponseBody); jResp.put_EmitCompact(false); wprintf(L"Response Body:\n"); wprintf(L"%s\n",jResp.emit()); int respStatusCode = http.get_LastStatus(); wprintf(L"Response Status Code = %d\n",respStatusCode); if (respStatusCode >= 400) { wprintf(L"Response Header:\n"); wprintf(L"%s\n",http.lastHeader()); wprintf(L"Failed.\n"); 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. const wchar_t *v_type = jResp.stringOf(L"_type"); const wchar_t *account_id = jResp.stringOf(L"account_id"); const wchar_t *bio = jResp.stringOf(L"bio"); const wchar_t *context = jResp.stringOf(L"context"); const wchar_t *deleted_at = jResp.stringOf(L"deleted_at"); const wchar_t *digest_frequency = jResp.stringOf(L"digest_frequency"); const wchar_t *email = jResp.stringOf(L"email"); const wchar_t *email_confirm_by = jResp.stringOf(L"email_confirm_by"); const wchar_t *email_preferences = jResp.stringOf(L"email_preferences"); const wchar_t *features_seen = jResp.stringOf(L"features_seen"); const wchar_t *first_login_at = jResp.stringOf(L"first_login_at"); bool from_google = jResp.BoolOf(L"from_google"); const wchar_t *id = jResp.stringOf(L"id"); const wchar_t *image_128 = jResp.stringOf(L"image_128"); const wchar_t *image_256 = jResp.stringOf(L"image_256"); const wchar_t *image_32 = jResp.stringOf(L"image_32"); const wchar_t *image_64 = jResp.stringOf(L"image_64"); const wchar_t *inserted_at = jResp.stringOf(L"inserted_at"); const wchar_t *joined_via = jResp.stringOf(L"joined_via"); const wchar_t *last_seen = jResp.stringOf(L"last_seen"); const wchar_t *location = jResp.stringOf(L"location"); const wchar_t *name = jResp.stringOf(L"name"); const wchar_t *next_digest_date = jResp.stringOf(L"next_digest_date"); const wchar_t *phone = jResp.stringOf(L"phone"); const wchar_t *profile_image = jResp.stringOf(L"profile_image"); const wchar_t *profile_image_original = jResp.stringOf(L"profile_image_original"); const wchar_t *roles = jResp.stringOf(L"roles"); const wchar_t *timezone_value = jResp.stringOf(L"timezone_value"); const wchar_t *updated_at = jResp.stringOf(L"updated_at"); const wchar_t *upload_url = jResp.stringOf(L"upload_url"); const wchar_t *user_default_color = jResp.stringOf(L"user_default_color"); const wchar_t *user_hash = jResp.stringOf(L"user_hash"); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.