Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(MFC) 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 <CkHttp.h> #include <CkStringBuilder.h> #include <CkJsonObject.h> void ChilkatSample(void) { CkString strOut; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttp 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("<FRAME_IO_DEV_TOKEN>"); CkStringBuilder sbResponseBody; success = http.QuickGetSb("https://api.frame.io/v2/me",sbResponseBody); if (success == false) { strOut.append(http.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } CkJsonObject jResp; jResp.LoadSb(sbResponseBody); jResp.put_EmitCompact(false); strOut.append("Response Body:"); strOut.append("\r\n"); strOut.append(jResp.emit()); strOut.append("\r\n"); int respStatusCode = http.get_LastStatus(); strOut.append("Response Status Code = "); strOut.appendInt(respStatusCode); strOut.append("\r\n"); if (respStatusCode >= 400) { strOut.append("Response Header:"); strOut.append("\r\n"); strOut.append(http.lastHeader()); strOut.append("\r\n"); strOut.append("Failed."); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); 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 char *v_type = jResp.stringOf("_type"); const char *account_id = jResp.stringOf("account_id"); const char *bio = jResp.stringOf("bio"); const char *context = jResp.stringOf("context"); const char *deleted_at = jResp.stringOf("deleted_at"); const char *digest_frequency = jResp.stringOf("digest_frequency"); const char *email = jResp.stringOf("email"); const char *email_confirm_by = jResp.stringOf("email_confirm_by"); const char *email_preferences = jResp.stringOf("email_preferences"); const char *features_seen = jResp.stringOf("features_seen"); const char *first_login_at = jResp.stringOf("first_login_at"); bool from_google = jResp.BoolOf("from_google"); const char *id = jResp.stringOf("id"); const char *image_128 = jResp.stringOf("image_128"); const char *image_256 = jResp.stringOf("image_256"); const char *image_32 = jResp.stringOf("image_32"); const char *image_64 = jResp.stringOf("image_64"); const char *inserted_at = jResp.stringOf("inserted_at"); const char *joined_via = jResp.stringOf("joined_via"); const char *last_seen = jResp.stringOf("last_seen"); const char *location = jResp.stringOf("location"); const char *name = jResp.stringOf("name"); const char *next_digest_date = jResp.stringOf("next_digest_date"); const char *phone = jResp.stringOf("phone"); const char *profile_image = jResp.stringOf("profile_image"); const char *profile_image_original = jResp.stringOf("profile_image_original"); const char *roles = jResp.stringOf("roles"); const char *timezone_value = jResp.stringOf("timezone_value"); const char *updated_at = jResp.stringOf("updated_at"); const char *upload_url = jResp.stringOf("upload_url"); const char *user_default_color = jResp.stringOf("user_default_color"); const char *user_hash = jResp.stringOf("user_hash"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); } |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.