Sample code for 30+ languages & platforms
Unicode C++

Frame.io - Create a Folder

See more Frame.io Examples

Create a folder asset as a child to the root_asset_id.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkHttpW.h>
#include <CkJsonObjectW.h>
#include <CkHttpResponseW.h>
#include <CkStringBuilderW.h>

void ChilkatSample(void)
    {
    bool success = false;

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttpW http;

    // 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"
    // }

    CkJsonObjectW json;
    json.UpdateString(L"type",L"folder");
    json.UpdateString(L"name",L"Folder at root");

    http.SetRequestHeader(L"content-type",L"application/json");
    // Adds the "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" header.
    http.put_AuthToken(L"<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.

    CkHttpResponseW resp;
    success = http.HttpJson(L"POST",L"https://api.frame.io/v2/assets/4ecb383f-71a8-4233-b665-d8f75136f554/children",json,L"application/json",resp);
    if (success == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    CkStringBuilderW sbResponseBody;
    resp.GetBodySb(sbResponseBody);
    CkJsonObjectW jResp;
    jResp.LoadSb(sbResponseBody);
    jResp.put_EmitCompact(false);

    wprintf(L"Response Body:\n");
    wprintf(L"%s\n",jResp.emit());

    int respStatusCode = resp.get_StatusCode();
    wprintf(L"Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",resp.header());
        wprintf(L"Failed.\n");
        return;
    }

    // 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 wchar_t *team_id = jResp.stringOf(L"team_id");
    int public_item_count = jResp.IntOf(L"public_item_count");
    const wchar_t *properties = jResp.stringOf(L"properties");
    const wchar_t *deleted_at = jResp.stringOf(L"deleted_at");
    const wchar_t *fps = jResp.stringOf(L"fps");
    const wchar_t *rating = jResp.stringOf(L"rating");
    const wchar_t *description = jResp.stringOf(L"description");
    const wchar_t *updated_at = jResp.stringOf(L"updated_at");
    const wchar_t *cover_asset_id = jResp.stringOf(L"cover_asset_id");
    const wchar_t *archive_scheduled_at = jResp.stringOf(L"archive_scheduled_at");
    const wchar_t *subtitle_tracks = jResp.stringOf(L"subtitle_tracks");
    const wchar_t *index = jResp.stringOf(L"index");
    int item_count = jResp.IntOf(L"item_count");
    const wchar_t *account_id = jResp.stringOf(L"account_id");
    const wchar_t *name = jResp.stringOf(L"name");
    const wchar_t *checksums = jResp.stringOf(L"checksums");
    const wchar_t *audio_tracks = jResp.stringOf(L"audio_tracks");
    const wchar_t *duration = jResp.stringOf(L"duration");
    const wchar_t *label = jResp.stringOf(L"label");
    bool is_session_watermarked = jResp.BoolOf(L"is_session_watermarked");
    const wchar_t *parent_id = jResp.stringOf(L"parent_id");
    int versions = jResp.IntOf(L"versions");
    const wchar_t *project_id = jResp.stringOf(L"project_id");
    const wchar_t *resource_id = jResp.stringOf(L"resource_id");
    bool v_private = jResp.BoolOf(L"private");
    int frames = jResp.IntOf(L"frames");
    const wchar_t *autoversion_id = jResp.stringOf(L"autoversion_id");
    const wchar_t *v_type = jResp.stringOf(L"type");
    const wchar_t *uploaded_at = jResp.stringOf(L"uploaded_at");
    const wchar_t *creator_id = jResp.stringOf(L"creator_id");
    bool user_permissionsCan_download = jResp.BoolOf(L"user_permissions.can_download");
    bool user_permissionsCan_modify_template = jResp.BoolOf(L"user_permissions.can_modify_template");
    bool user_permissionsCan_public_share_presentation = jResp.BoolOf(L"user_permissions.can_public_share_presentation");
    bool user_permissionsCan_public_share_review_link = jResp.BoolOf(L"user_permissions.can_public_share_review_link");
    bool user_permissionsCan_share_downloadable_presentation = jResp.BoolOf(L"user_permissions.can_share_downloadable_presentation");
    bool user_permissionsCan_share_downloadable_review_link = jResp.BoolOf(L"user_permissions.can_share_downloadable_review_link");
    bool user_permissionsCan_share_unwatermarked_presentation = jResp.BoolOf(L"user_permissions.can_share_unwatermarked_presentation");
    bool user_permissionsCan_share_unwatermarked_review_link = jResp.BoolOf(L"user_permissions.can_share_unwatermarked_review_link");
    bool shared = jResp.BoolOf(L"shared");
    bool is_360 = jResp.BoolOf(L"is_360");
    v_type = jResp.stringOf(L"_type");
    int comment_count = jResp.IntOf(L"comment_count");
    const wchar_t *archived_at = jResp.stringOf(L"archived_at");
    const wchar_t *filetype = jResp.stringOf(L"filetype");
    const wchar_t *id = jResp.stringOf(L"id");
    const wchar_t *hard_deleted_at = jResp.stringOf(L"hard_deleted_at");
    bool copy = jResp.BoolOf(L"copy");
    bool is_hls_required = jResp.BoolOf(L"is_hls_required");
    const wchar_t *archive_status = jResp.stringOf(L"archive_status");
    const wchar_t *inserted_at = jResp.stringOf(L"inserted_at");
    int filesize = jResp.IntOf(L"filesize");
    }