Sample code for 30+ languages & platforms
Rust

Frame.io - Create a Folder

See more Frame.io Examples

Create a folder asset as a child to the root_asset_id.

Chilkat Rust Downloads

Rust

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

let http = chilkat::Http::new();

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

let json = chilkat::JsonObject::new();
let _ = json.update_string("type", "folder");
let _ = json.update_string("name", "Folder at root");

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

let resp = chilkat::HttpResponse::new();
if http.http_json("POST", "https://api.frame.io/v2/assets/4ecb383f-71a8-4233-b665-d8f75136f554/children", &json, "application/json", &resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

let sb_response_body = chilkat::StringBuilder::new();
let _ = resp.get_body_sb(&sb_response_body);
let j_resp = chilkat::JsonObject::new();
let _ = j_resp.load_sb(&sb_response_body);
j_resp.set_emit_compact(false);

println!("Response Body:");
println!("{}", j_resp.emit().unwrap_or_default());

let resp_status_code = resp.status_code();
println!("Response Status Code = {}", resp_status_code);
if resp_status_code >= 400 {
    println!("Response Header:");
    println!("{}", resp.header());
    println!("Failed.");
    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

let team_id = j_resp.string_of("team_id").unwrap_or_default();
let public_item_count = j_resp.int_of("public_item_count");
let properties = j_resp.string_of("properties").unwrap_or_default();
let deleted_at = j_resp.string_of("deleted_at").unwrap_or_default();
let fps = j_resp.string_of("fps").unwrap_or_default();
let rating = j_resp.string_of("rating").unwrap_or_default();
let description = j_resp.string_of("description").unwrap_or_default();
let updated_at = j_resp.string_of("updated_at").unwrap_or_default();
let cover_asset_id = j_resp.string_of("cover_asset_id").unwrap_or_default();
let archive_scheduled_at = j_resp.string_of("archive_scheduled_at").unwrap_or_default();
let subtitle_tracks = j_resp.string_of("subtitle_tracks").unwrap_or_default();
let index = j_resp.string_of("index").unwrap_or_default();
let item_count = j_resp.int_of("item_count");
let account_id = j_resp.string_of("account_id").unwrap_or_default();
let name = j_resp.string_of("name").unwrap_or_default();
let checksums = j_resp.string_of("checksums").unwrap_or_default();
let audio_tracks = j_resp.string_of("audio_tracks").unwrap_or_default();
let duration = j_resp.string_of("duration").unwrap_or_default();
let label = j_resp.string_of("label").unwrap_or_default();
let is_session_watermarked = j_resp.bool_of("is_session_watermarked");
let parent_id = j_resp.string_of("parent_id").unwrap_or_default();
let versions = j_resp.int_of("versions");
let project_id = j_resp.string_of("project_id").unwrap_or_default();
let resource_id = j_resp.string_of("resource_id").unwrap_or_default();
let v_private = j_resp.bool_of("private");
let frames = j_resp.int_of("frames");
let autoversion_id = j_resp.string_of("autoversion_id").unwrap_or_default();
let mut v_type = j_resp.string_of("type").unwrap_or_default();
let uploaded_at = j_resp.string_of("uploaded_at").unwrap_or_default();
let creator_id = j_resp.string_of("creator_id").unwrap_or_default();
let user_permissions_can_download = j_resp.bool_of("user_permissions.can_download");
let user_permissions_can_modify_template = j_resp.bool_of("user_permissions.can_modify_template");
let user_permissions_can_public_share_presentation = j_resp.bool_of("user_permissions.can_public_share_presentation");
let user_permissions_can_public_share_review_link = j_resp.bool_of("user_permissions.can_public_share_review_link");
let user_permissions_can_share_downloadable_presentation = j_resp.bool_of("user_permissions.can_share_downloadable_presentation");
let user_permissions_can_share_downloadable_review_link = j_resp.bool_of("user_permissions.can_share_downloadable_review_link");
let user_permissions_can_share_unwatermarked_presentation = j_resp.bool_of("user_permissions.can_share_unwatermarked_presentation");
let user_permissions_can_share_unwatermarked_review_link = j_resp.bool_of("user_permissions.can_share_unwatermarked_review_link");
let shared = j_resp.bool_of("shared");
let is_360 = j_resp.bool_of("is_360");
v_type = j_resp.string_of("_type").unwrap_or_default();
let comment_count = j_resp.int_of("comment_count");
let archived_at = j_resp.string_of("archived_at").unwrap_or_default();
let filetype = j_resp.string_of("filetype").unwrap_or_default();
let id = j_resp.string_of("id").unwrap_or_default();
let hard_deleted_at = j_resp.string_of("hard_deleted_at").unwrap_or_default();
let copy = j_resp.bool_of("copy");
let is_hls_required = j_resp.bool_of("is_hls_required");
let archive_status = j_resp.string_of("archive_status").unwrap_or_default();
let inserted_at = j_resp.string_of("inserted_at").unwrap_or_default();
let filesize = j_resp.int_of("filesize");