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
(Swift 3,4,5...) 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
func chilkatTest() { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. let http = CkoHttp()! var success: Bool // 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 = CkoJsonObject()! json.update("type", value: "folder") json.update("name", value: "Folder at root") http.setRequestHeader("content-type", value: "application/json") // Adds the "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" header. http.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. var resp: CkoHttpResponse? = http.postJson3("https://api.frame.io/v2/assets/4ecb383f-71a8-4233-b665-d8f75136f554/children", contentType: "application/json", json: json) if http.lastMethodSuccess == false { print("\(http.lastErrorText!)") return } let sbResponseBody = CkoStringBuilder()! resp!.getBodySb(sbResponseBody) let jResp = CkoJsonObject()! jResp.loadSb(sbResponseBody) jResp.emitCompact = false print("Response Body:") print("\(jResp.emit()!)") var respStatusCode: Int = resp!.statusCode.intValue print("Response Status Code = \(respStatusCode)") if respStatusCode >= 400 { print("Response Header:") print("\(resp!.header!)") print("Failed.") resp = nil return } resp = nil // 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 var team_id: String? = jResp.string(of: "team_id") var public_item_count: Int = jResp.int(of: "public_item_count").intValue var properties: String? = jResp.string(of: "properties") var deleted_at: String? = jResp.string(of: "deleted_at") var fps: String? = jResp.string(of: "fps") var rating: String? = jResp.string(of: "rating") var description: String? = jResp.string(of: "description") var updated_at: String? = jResp.string(of: "updated_at") var cover_asset_id: String? = jResp.string(of: "cover_asset_id") var archive_scheduled_at: String? = jResp.string(of: "archive_scheduled_at") var subtitle_tracks: String? = jResp.string(of: "subtitle_tracks") var index: String? = jResp.string(of: "index") var item_count: Int = jResp.int(of: "item_count").intValue var account_id: String? = jResp.string(of: "account_id") var name: String? = jResp.string(of: "name") var checksums: String? = jResp.string(of: "checksums") var audio_tracks: String? = jResp.string(of: "audio_tracks") var duration: String? = jResp.string(of: "duration") var label: String? = jResp.string(of: "label") var is_session_watermarked: Bool = jResp.bool(of: "is_session_watermarked") var parent_id: String? = jResp.string(of: "parent_id") var versions: Int = jResp.int(of: "versions").intValue var project_id: String? = jResp.string(of: "project_id") var resource_id: String? = jResp.string(of: "resource_id") var v_private: Bool = jResp.bool(of: "private") var frames: Int = jResp.int(of: "frames").intValue var autoversion_id: String? = jResp.string(of: "autoversion_id") var v_type: String? = jResp.string(of: "type") var uploaded_at: String? = jResp.string(of: "uploaded_at") var creator_id: String? = jResp.string(of: "creator_id") var user_permissionsCan_download: Bool = jResp.bool(of: "user_permissions.can_download") var user_permissionsCan_modify_template: Bool = jResp.bool(of: "user_permissions.can_modify_template") var user_permissionsCan_public_share_presentation: Bool = jResp.bool(of: "user_permissions.can_public_share_presentation") var user_permissionsCan_public_share_review_link: Bool = jResp.bool(of: "user_permissions.can_public_share_review_link") var user_permissionsCan_share_downloadable_presentation: Bool = jResp.bool(of: "user_permissions.can_share_downloadable_presentation") var user_permissionsCan_share_downloadable_review_link: Bool = jResp.bool(of: "user_permissions.can_share_downloadable_review_link") var user_permissionsCan_share_unwatermarked_presentation: Bool = jResp.bool(of: "user_permissions.can_share_unwatermarked_presentation") var user_permissionsCan_share_unwatermarked_review_link: Bool = jResp.bool(of: "user_permissions.can_share_unwatermarked_review_link") var shared: Bool = jResp.bool(of: "shared") var is_360: Bool = jResp.bool(of: "is_360") v_type = jResp.string(of: "_type") var comment_count: Int = jResp.int(of: "comment_count").intValue var archived_at: String? = jResp.string(of: "archived_at") var filetype: String? = jResp.string(of: "filetype") var id: String? = jResp.string(of: "id") var hard_deleted_at: String? = jResp.string(of: "hard_deleted_at") var copy: Bool = jResp.bool(of: "copy") var is_hls_required: Bool = jResp.bool(of: "is_hls_required") var archive_status: String? = jResp.string(of: "archive_status") var inserted_at: String? = jResp.string(of: "inserted_at") var filesize: Int = jResp.int(of: "filesize").intValue } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.