Sample code for 30+ languages & platforms
Tcl

Frame.io - Create a Folder

See more Frame.io Examples

Create a folder asset as a child to the root_asset_id.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

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

set http [new_CkHttp]

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

set json [new_CkJsonObject]

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_put_AuthToken $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.

set resp [new_CkHttpResponse]

set success [CkHttp_HttpJson $http "POST" "https://api.frame.io/v2/assets/4ecb383f-71a8-4233-b665-d8f75136f554/children" $json "application/json" $resp]
if {$success == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkJsonObject $json
    delete_CkHttpResponse $resp
    exit
}

set sbResponseBody [new_CkStringBuilder]

CkHttpResponse_GetBodySb $resp $sbResponseBody
set jResp [new_CkJsonObject]

CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0

puts "Response Body:"
puts [CkJsonObject_emit $jResp]

set respStatusCode [CkHttpResponse_get_StatusCode $resp]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
    puts "Response Header:"
    puts [CkHttpResponse_header $resp]
    puts "Failed."
    delete_CkHttp $http
    delete_CkJsonObject $json
    delete_CkHttpResponse $resp
    delete_CkStringBuilder $sbResponseBody
    delete_CkJsonObject $jResp
    exit
}

# 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

set team_id [CkJsonObject_stringOf $jResp "team_id"]
set public_item_count [CkJsonObject_IntOf $jResp "public_item_count"]
set properties [CkJsonObject_stringOf $jResp "properties"]
set deleted_at [CkJsonObject_stringOf $jResp "deleted_at"]
set fps [CkJsonObject_stringOf $jResp "fps"]
set rating [CkJsonObject_stringOf $jResp "rating"]
set description [CkJsonObject_stringOf $jResp "description"]
set updated_at [CkJsonObject_stringOf $jResp "updated_at"]
set cover_asset_id [CkJsonObject_stringOf $jResp "cover_asset_id"]
set archive_scheduled_at [CkJsonObject_stringOf $jResp "archive_scheduled_at"]
set subtitle_tracks [CkJsonObject_stringOf $jResp "subtitle_tracks"]
set index [CkJsonObject_stringOf $jResp "index"]
set item_count [CkJsonObject_IntOf $jResp "item_count"]
set account_id [CkJsonObject_stringOf $jResp "account_id"]
set name [CkJsonObject_stringOf $jResp "name"]
set checksums [CkJsonObject_stringOf $jResp "checksums"]
set audio_tracks [CkJsonObject_stringOf $jResp "audio_tracks"]
set duration [CkJsonObject_stringOf $jResp "duration"]
set label [CkJsonObject_stringOf $jResp "label"]
set is_session_watermarked [CkJsonObject_BoolOf $jResp "is_session_watermarked"]
set parent_id [CkJsonObject_stringOf $jResp "parent_id"]
set versions [CkJsonObject_IntOf $jResp "versions"]
set project_id [CkJsonObject_stringOf $jResp "project_id"]
set resource_id [CkJsonObject_stringOf $jResp "resource_id"]
set v_private [CkJsonObject_BoolOf $jResp "private"]
set frames [CkJsonObject_IntOf $jResp "frames"]
set autoversion_id [CkJsonObject_stringOf $jResp "autoversion_id"]
set v_type [CkJsonObject_stringOf $jResp "type"]
set uploaded_at [CkJsonObject_stringOf $jResp "uploaded_at"]
set creator_id [CkJsonObject_stringOf $jResp "creator_id"]
set user_permissionsCan_download [CkJsonObject_BoolOf $jResp "user_permissions.can_download"]
set user_permissionsCan_modify_template [CkJsonObject_BoolOf $jResp "user_permissions.can_modify_template"]
set user_permissionsCan_public_share_presentation [CkJsonObject_BoolOf $jResp "user_permissions.can_public_share_presentation"]
set user_permissionsCan_public_share_review_link [CkJsonObject_BoolOf $jResp "user_permissions.can_public_share_review_link"]
set user_permissionsCan_share_downloadable_presentation [CkJsonObject_BoolOf $jResp "user_permissions.can_share_downloadable_presentation"]
set user_permissionsCan_share_downloadable_review_link [CkJsonObject_BoolOf $jResp "user_permissions.can_share_downloadable_review_link"]
set user_permissionsCan_share_unwatermarked_presentation [CkJsonObject_BoolOf $jResp "user_permissions.can_share_unwatermarked_presentation"]
set user_permissionsCan_share_unwatermarked_review_link [CkJsonObject_BoolOf $jResp "user_permissions.can_share_unwatermarked_review_link"]
set shared [CkJsonObject_BoolOf $jResp "shared"]
set is_360 [CkJsonObject_BoolOf $jResp "is_360"]
set v_type [CkJsonObject_stringOf $jResp "_type"]
set comment_count [CkJsonObject_IntOf $jResp "comment_count"]
set archived_at [CkJsonObject_stringOf $jResp "archived_at"]
set filetype [CkJsonObject_stringOf $jResp "filetype"]
set id [CkJsonObject_stringOf $jResp "id"]
set hard_deleted_at [CkJsonObject_stringOf $jResp "hard_deleted_at"]
set copy [CkJsonObject_BoolOf $jResp "copy"]
set is_hls_required [CkJsonObject_BoolOf $jResp "is_hls_required"]
set archive_status [CkJsonObject_stringOf $jResp "archive_status"]
set inserted_at [CkJsonObject_stringOf $jResp "inserted_at"]
set filesize [CkJsonObject_IntOf $jResp "filesize"]

delete_CkHttp $http
delete_CkJsonObject $json
delete_CkHttpResponse $resp
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp