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 - Create a FolderCreate a folder asset as a child to the root_asset_id. For more information, see https://docs.frame.io/docs/root-asset-ids
#include <CkHttp.h> #include <CkJsonObject.h> #include <CkHttpResponse.h> #include <CkStringBuilder.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 --request POST \ // --url https://api.frame.io/v2/assets/<root_asset_id>/children \ // --header 'authorization: Bearer <FRAME_IO_DEV_TOKEN>' \ // --header 'content-type: application/json' \ // --data '{"type":"folder", "name": "Folder at root"}' // Use the following online tool to generate HTTP code from a CURL command // Convert a cURL Command to HTTP Source Code // Use this online tool to generate code from sample JSON: // Generate Code to Create JSON // The following JSON is sent in the request body. // { // "type": "folder", // "name": "Folder at root" // } CkJsonObject json; json.UpdateString("type","folder"); json.UpdateString("name","Folder at root"); http.SetRequestHeader("content-type","application/json"); // Adds the "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" header. http.put_AuthToken("<FRAME_IO_DEV_TOKEN>"); // Our root_asset_id = 4ecb383f-71a8-4233-b665-d8f75136f554 // You'll need to modify the following line to use your root asset ID. CkHttpResponse *resp = http.PostJson3("https://api.frame.io/v2/assets/4ecb383f-71a8-4233-b665-d8f75136f554/children","application/json",json); if (http.get_LastMethodSuccess() == false) { strOut.append(http.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } CkStringBuilder sbResponseBody; resp->GetBodySb(sbResponseBody); 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 = resp->get_StatusCode(); 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(resp->header()); strOut.append("\r\n"); strOut.append("Failed."); strOut.append("\r\n"); delete resp; SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } delete resp; // Sample JSON response: // (Sample code for parsing the JSON response is shown below) // { // "team_id": "95a5fbad-688d-46fc-aef1-2f011dd76c10", // "public_item_count": 0, // "properties": null, // "deleted_at": null, // "fps": null, // "rating": null, // "description": null, // "updated_at": "2020-08-18T03:31:59.699011Z", // "cover_asset_id": null, // "archive_scheduled_at": null, // "subtitle_tracks": null, // "index": -7.0, // "item_count": 0, // "account_id": "b1cd046b-a3bf-4ef8-81a6-0afd74ecc455", // "name": "FolderA", // "checksums": null, // "audio_tracks": null, // "duration": null, // "label": "none", // "is_session_watermarked": false, // "parent_id": "4ecb383f-71a8-4233-b665-d8f75136f554", // "versions": 0, // "project_id": "e76653c4-6cc0-4c47-936b-f7885b477dc0", // "resource_id": null, // "private": false, // "frames": 0, // "autoversion_id": null, // "type": "folder", // "uploaded_at": "2020-08-18T03:31:59.697174Z", // "creator_id": "34b4f98a-7cc9-4159-8f46-c7c3d837fc6f", // "user_permissions": { // "can_download": true, // "can_modify_template": false, // "can_public_share_presentation": true, // "can_public_share_review_link": true, // "can_share_downloadable_presentation": true, // "can_share_downloadable_review_link": true, // "can_share_unwatermarked_presentation": true, // "can_share_unwatermarked_review_link": true // }, // "shared": false, // "is_360": false, // "_type": "folder", // "comment_count": 0, // "archived_at": null, // "filetype": null, // "id": "039845e8-bffe-4d6b-88d3-c780bae06342", // "hard_deleted_at": null, // "copy": false, // "is_hls_required": false, // "archive_status": null, // "inserted_at": "2020-08-18T03:31:59.699011Z", // "filesize": 0 // } // 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 *team_id = jResp.stringOf("team_id"); int public_item_count = jResp.IntOf("public_item_count"); const char *properties = jResp.stringOf("properties"); const char *deleted_at = jResp.stringOf("deleted_at"); const char *fps = jResp.stringOf("fps"); const char *rating = jResp.stringOf("rating"); const char *description = jResp.stringOf("description"); const char *updated_at = jResp.stringOf("updated_at"); const char *cover_asset_id = jResp.stringOf("cover_asset_id"); const char *archive_scheduled_at = jResp.stringOf("archive_scheduled_at"); const char *subtitle_tracks = jResp.stringOf("subtitle_tracks"); const char *index = jResp.stringOf("index"); int item_count = jResp.IntOf("item_count"); const char *account_id = jResp.stringOf("account_id"); const char *name = jResp.stringOf("name"); const char *checksums = jResp.stringOf("checksums"); const char *audio_tracks = jResp.stringOf("audio_tracks"); const char *duration = jResp.stringOf("duration"); const char *label = jResp.stringOf("label"); bool is_session_watermarked = jResp.BoolOf("is_session_watermarked"); const char *parent_id = jResp.stringOf("parent_id"); int versions = jResp.IntOf("versions"); const char *project_id = jResp.stringOf("project_id"); const char *resource_id = jResp.stringOf("resource_id"); bool v_private = jResp.BoolOf("private"); int frames = jResp.IntOf("frames"); const char *autoversion_id = jResp.stringOf("autoversion_id"); const char *v_type = jResp.stringOf("type"); const char *uploaded_at = jResp.stringOf("uploaded_at"); const char *creator_id = jResp.stringOf("creator_id"); bool user_permissionsCan_download = jResp.BoolOf("user_permissions.can_download"); bool user_permissionsCan_modify_template = jResp.BoolOf("user_permissions.can_modify_template"); bool user_permissionsCan_public_share_presentation = jResp.BoolOf("user_permissions.can_public_share_presentation"); bool user_permissionsCan_public_share_review_link = jResp.BoolOf("user_permissions.can_public_share_review_link"); bool user_permissionsCan_share_downloadable_presentation = jResp.BoolOf("user_permissions.can_share_downloadable_presentation"); bool user_permissionsCan_share_downloadable_review_link = jResp.BoolOf("user_permissions.can_share_downloadable_review_link"); bool user_permissionsCan_share_unwatermarked_presentation = jResp.BoolOf("user_permissions.can_share_unwatermarked_presentation"); bool user_permissionsCan_share_unwatermarked_review_link = jResp.BoolOf("user_permissions.can_share_unwatermarked_review_link"); bool shared = jResp.BoolOf("shared"); bool is_360 = jResp.BoolOf("is_360"); v_type = jResp.stringOf("_type"); int comment_count = jResp.IntOf("comment_count"); const char *archived_at = jResp.stringOf("archived_at"); const char *filetype = jResp.stringOf("filetype"); const char *id = jResp.stringOf("id"); const char *hard_deleted_at = jResp.stringOf("hard_deleted_at"); bool copy = jResp.BoolOf("copy"); bool is_hls_required = jResp.BoolOf("is_hls_required"); const char *archive_status = jResp.stringOf("archive_status"); const char *inserted_at = jResp.stringOf("inserted_at"); int filesize = jResp.IntOf("filesize"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); } |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.