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 - 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 <C_CkHttp.h> #include <C_CkJsonObject.h> #include <C_CkHttpResponse.h> #include <C_CkStringBuilder.h> void ChilkatSample(void) { HCkHttp http; BOOL success; HCkJsonObject json; HCkHttpResponse resp; HCkStringBuilder sbResponseBody; HCkJsonObject jResp; int respStatusCode; const char *team_id; int public_item_count; const char *properties; const char *deleted_at; const char *fps; const char *rating; const char *description; const char *updated_at; const char *cover_asset_id; const char *archive_scheduled_at; const char *subtitle_tracks; const char *index; int item_count; const char *account_id; const char *name; const char *checksums; const char *audio_tracks; const char *duration; const char *label; BOOL is_session_watermarked; const char *parent_id; int versions; const char *project_id; const char *resource_id; BOOL v_private; int frames; const char *autoversion_id; const char *v_type; const char *uploaded_at; const char *creator_id; BOOL user_permissionsCan_download; BOOL user_permissionsCan_modify_template; BOOL user_permissionsCan_public_share_presentation; BOOL user_permissionsCan_public_share_review_link; BOOL user_permissionsCan_share_downloadable_presentation; BOOL user_permissionsCan_share_downloadable_review_link; BOOL user_permissionsCan_share_unwatermarked_presentation; BOOL user_permissionsCan_share_unwatermarked_review_link; BOOL shared; BOOL is_360; int comment_count; const char *archived_at; const char *filetype; const char *id; const char *hard_deleted_at; BOOL copy; BOOL is_hls_required; const char *archive_status; const char *inserted_at; int filesize; // 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 --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" // } json = CkJsonObject_Create(); CkJsonObject_UpdateString(json,"type","folder"); CkJsonObject_UpdateString(json,"name","Folder at root"); CkHttp_SetRequestHeader(http,"content-type","application/json"); // Adds the "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" header. CkHttp_putAuthToken(http,"<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. resp = CkHttp_PostJson3(http,"https://api.frame.io/v2/assets/4ecb383f-71a8-4233-b665-d8f75136f554/children","application/json",json); if (CkHttp_getLastMethodSuccess(http) == FALSE) { printf("%s\n",CkHttp_lastErrorText(http)); CkHttp_Dispose(http); CkJsonObject_Dispose(json); return; } sbResponseBody = CkStringBuilder_Create(); CkHttpResponse_GetBodySb(resp,sbResponseBody); jResp = CkJsonObject_Create(); CkJsonObject_LoadSb(jResp,sbResponseBody); CkJsonObject_putEmitCompact(jResp,FALSE); printf("Response Body:\n"); printf("%s\n",CkJsonObject_emit(jResp)); respStatusCode = CkHttpResponse_getStatusCode(resp); printf("Response Status Code = %d\n",respStatusCode); if (respStatusCode >= 400) { printf("Response Header:\n"); printf("%s\n",CkHttpResponse_header(resp)); printf("Failed.\n"); CkHttpResponse_Dispose(resp); CkHttp_Dispose(http); CkJsonObject_Dispose(json); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); return; } CkHttpResponse_Dispose(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. team_id = CkJsonObject_stringOf(jResp,"team_id"); public_item_count = CkJsonObject_IntOf(jResp,"public_item_count"); properties = CkJsonObject_stringOf(jResp,"properties"); deleted_at = CkJsonObject_stringOf(jResp,"deleted_at"); fps = CkJsonObject_stringOf(jResp,"fps"); rating = CkJsonObject_stringOf(jResp,"rating"); description = CkJsonObject_stringOf(jResp,"description"); updated_at = CkJsonObject_stringOf(jResp,"updated_at"); cover_asset_id = CkJsonObject_stringOf(jResp,"cover_asset_id"); archive_scheduled_at = CkJsonObject_stringOf(jResp,"archive_scheduled_at"); subtitle_tracks = CkJsonObject_stringOf(jResp,"subtitle_tracks"); index = CkJsonObject_stringOf(jResp,"index"); item_count = CkJsonObject_IntOf(jResp,"item_count"); account_id = CkJsonObject_stringOf(jResp,"account_id"); name = CkJsonObject_stringOf(jResp,"name"); checksums = CkJsonObject_stringOf(jResp,"checksums"); audio_tracks = CkJsonObject_stringOf(jResp,"audio_tracks"); duration = CkJsonObject_stringOf(jResp,"duration"); label = CkJsonObject_stringOf(jResp,"label"); is_session_watermarked = CkJsonObject_BoolOf(jResp,"is_session_watermarked"); parent_id = CkJsonObject_stringOf(jResp,"parent_id"); versions = CkJsonObject_IntOf(jResp,"versions"); project_id = CkJsonObject_stringOf(jResp,"project_id"); resource_id = CkJsonObject_stringOf(jResp,"resource_id"); v_private = CkJsonObject_BoolOf(jResp,"private"); frames = CkJsonObject_IntOf(jResp,"frames"); autoversion_id = CkJsonObject_stringOf(jResp,"autoversion_id"); v_type = CkJsonObject_stringOf(jResp,"type"); uploaded_at = CkJsonObject_stringOf(jResp,"uploaded_at"); creator_id = CkJsonObject_stringOf(jResp,"creator_id"); user_permissionsCan_download = CkJsonObject_BoolOf(jResp,"user_permissions.can_download"); user_permissionsCan_modify_template = CkJsonObject_BoolOf(jResp,"user_permissions.can_modify_template"); user_permissionsCan_public_share_presentation = CkJsonObject_BoolOf(jResp,"user_permissions.can_public_share_presentation"); user_permissionsCan_public_share_review_link = CkJsonObject_BoolOf(jResp,"user_permissions.can_public_share_review_link"); user_permissionsCan_share_downloadable_presentation = CkJsonObject_BoolOf(jResp,"user_permissions.can_share_downloadable_presentation"); user_permissionsCan_share_downloadable_review_link = CkJsonObject_BoolOf(jResp,"user_permissions.can_share_downloadable_review_link"); user_permissionsCan_share_unwatermarked_presentation = CkJsonObject_BoolOf(jResp,"user_permissions.can_share_unwatermarked_presentation"); user_permissionsCan_share_unwatermarked_review_link = CkJsonObject_BoolOf(jResp,"user_permissions.can_share_unwatermarked_review_link"); shared = CkJsonObject_BoolOf(jResp,"shared"); is_360 = CkJsonObject_BoolOf(jResp,"is_360"); v_type = CkJsonObject_stringOf(jResp,"_type"); comment_count = CkJsonObject_IntOf(jResp,"comment_count"); archived_at = CkJsonObject_stringOf(jResp,"archived_at"); filetype = CkJsonObject_stringOf(jResp,"filetype"); id = CkJsonObject_stringOf(jResp,"id"); hard_deleted_at = CkJsonObject_stringOf(jResp,"hard_deleted_at"); copy = CkJsonObject_BoolOf(jResp,"copy"); is_hls_required = CkJsonObject_BoolOf(jResp,"is_hls_required"); archive_status = CkJsonObject_stringOf(jResp,"archive_status"); inserted_at = CkJsonObject_stringOf(jResp,"inserted_at"); filesize = CkJsonObject_IntOf(jResp,"filesize"); CkHttp_Dispose(http); CkJsonObject_Dispose(json); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.