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
(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 <C_CkHttp.h> #include <C_CkStringBuilder.h> #include <C_CkJsonObject.h> void ChilkatSample(void) { HCkHttp http; BOOL success; HCkStringBuilder sbResponseBody; HCkJsonObject jResp; int respStatusCode; const char *v_type; const char *account_id; const char *bio; const char *context; const char *deleted_at; const char *digest_frequency; const char *email; const char *email_confirm_by; const char *email_preferences; const char *features_seen; const char *first_login_at; BOOL from_google; const char *id; const char *image_128; const char *image_256; const char *image_32; const char *image_64; const char *inserted_at; const char *joined_via; const char *last_seen; const char *location; const char *name; const char *next_digest_date; const char *phone; const char *profile_image; const char *profile_image_original; const char *roles; const char *timezone_value; const char *updated_at; const char *upload_url; const char *user_default_color; const char *user_hash; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttp_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. CkHttp_putAuthToken(http,"<FRAME_IO_DEV_TOKEN>"); sbResponseBody = CkStringBuilder_Create(); success = CkHttp_QuickGetSb(http,"https://api.frame.io/v2/me",sbResponseBody); if (success == FALSE) { printf("%s\n",CkHttp_lastErrorText(http)); CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); return; } jResp = CkJsonObject_Create(); CkJsonObject_LoadSb(jResp,sbResponseBody); CkJsonObject_putEmitCompact(jResp,FALSE); printf("Response Body:\n"); printf("%s\n",CkJsonObject_emit(jResp)); respStatusCode = CkHttp_getLastStatus(http); printf("Response Status Code = %d\n",respStatusCode); if (respStatusCode >= 400) { printf("Response Header:\n"); printf("%s\n",CkHttp_lastHeader(http)); printf("Failed.\n"); CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_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 = CkJsonObject_stringOf(jResp,"_type"); account_id = CkJsonObject_stringOf(jResp,"account_id"); bio = CkJsonObject_stringOf(jResp,"bio"); context = CkJsonObject_stringOf(jResp,"context"); deleted_at = CkJsonObject_stringOf(jResp,"deleted_at"); digest_frequency = CkJsonObject_stringOf(jResp,"digest_frequency"); email = CkJsonObject_stringOf(jResp,"email"); email_confirm_by = CkJsonObject_stringOf(jResp,"email_confirm_by"); email_preferences = CkJsonObject_stringOf(jResp,"email_preferences"); features_seen = CkJsonObject_stringOf(jResp,"features_seen"); first_login_at = CkJsonObject_stringOf(jResp,"first_login_at"); from_google = CkJsonObject_BoolOf(jResp,"from_google"); id = CkJsonObject_stringOf(jResp,"id"); image_128 = CkJsonObject_stringOf(jResp,"image_128"); image_256 = CkJsonObject_stringOf(jResp,"image_256"); image_32 = CkJsonObject_stringOf(jResp,"image_32"); image_64 = CkJsonObject_stringOf(jResp,"image_64"); inserted_at = CkJsonObject_stringOf(jResp,"inserted_at"); joined_via = CkJsonObject_stringOf(jResp,"joined_via"); last_seen = CkJsonObject_stringOf(jResp,"last_seen"); location = CkJsonObject_stringOf(jResp,"location"); name = CkJsonObject_stringOf(jResp,"name"); next_digest_date = CkJsonObject_stringOf(jResp,"next_digest_date"); phone = CkJsonObject_stringOf(jResp,"phone"); profile_image = CkJsonObject_stringOf(jResp,"profile_image"); profile_image_original = CkJsonObject_stringOf(jResp,"profile_image_original"); roles = CkJsonObject_stringOf(jResp,"roles"); timezone_value = CkJsonObject_stringOf(jResp,"timezone_value"); updated_at = CkJsonObject_stringOf(jResp,"updated_at"); upload_url = CkJsonObject_stringOf(jResp,"upload_url"); user_default_color = CkJsonObject_stringOf(jResp,"user_default_color"); user_hash = CkJsonObject_stringOf(jResp,"user_hash"); CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.