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
(Objective-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
#import <CkoHttp.h> #import <CkoJsonObject.h> #import <CkoHttpResponse.h> #import <CkoStringBuilder.h> #import <NSString.h> // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkoHttp *http = [[CkoHttp alloc] init]; BOOL success; // 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" // } CkoJsonObject *json = [[CkoJsonObject alloc] init]; [json UpdateString: @"type" value: @"folder"]; [json UpdateString: @"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. CkoHttpResponse *resp = [http PostJson3: @"https://api.frame.io/v2/assets/4ecb383f-71a8-4233-b665-d8f75136f554/children" contentType: @"application/json" json: json]; if (http.LastMethodSuccess == NO) { NSLog(@"%@",http.LastErrorText); return; } CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init]; [resp GetBodySb: sbResponseBody]; CkoJsonObject *jResp = [[CkoJsonObject alloc] init]; [jResp LoadSb: sbResponseBody]; jResp.EmitCompact = NO; NSLog(@"%@",@"Response Body:"); NSLog(@"%@",[jResp Emit]); int respStatusCode = [resp.StatusCode intValue]; NSLog(@"%@%d",@"Response Status Code = ",respStatusCode); if (respStatusCode >= 400) { NSLog(@"%@",@"Response Header:"); NSLog(@"%@",resp.Header); NSLog(@"%@",@"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 NSString *team_id = [jResp StringOf: @"team_id"]; int public_item_count = [[jResp IntOf: @"public_item_count"] intValue]; NSString *properties = [jResp StringOf: @"properties"]; NSString *deleted_at = [jResp StringOf: @"deleted_at"]; NSString *fps = [jResp StringOf: @"fps"]; NSString *rating = [jResp StringOf: @"rating"]; NSString *description = [jResp StringOf: @"description"]; NSString *updated_at = [jResp StringOf: @"updated_at"]; NSString *cover_asset_id = [jResp StringOf: @"cover_asset_id"]; NSString *archive_scheduled_at = [jResp StringOf: @"archive_scheduled_at"]; NSString *subtitle_tracks = [jResp StringOf: @"subtitle_tracks"]; NSString *index = [jResp StringOf: @"index"]; int item_count = [[jResp IntOf: @"item_count"] intValue]; NSString *account_id = [jResp StringOf: @"account_id"]; NSString *name = [jResp StringOf: @"name"]; NSString *checksums = [jResp StringOf: @"checksums"]; NSString *audio_tracks = [jResp StringOf: @"audio_tracks"]; NSString *duration = [jResp StringOf: @"duration"]; NSString *label = [jResp StringOf: @"label"]; BOOL is_session_watermarked = [jResp BoolOf: @"is_session_watermarked"]; NSString *parent_id = [jResp StringOf: @"parent_id"]; int versions = [[jResp IntOf: @"versions"] intValue]; NSString *project_id = [jResp StringOf: @"project_id"]; NSString *resource_id = [jResp StringOf: @"resource_id"]; BOOL v_private = [jResp BoolOf: @"private"]; int frames = [[jResp IntOf: @"frames"] intValue]; NSString *autoversion_id = [jResp StringOf: @"autoversion_id"]; NSString *v_type = [jResp StringOf: @"type"]; NSString *uploaded_at = [jResp StringOf: @"uploaded_at"]; NSString *creator_id = [jResp StringOf: @"creator_id"]; BOOL user_permissionsCan_download = [jResp BoolOf: @"user_permissions.can_download"]; BOOL user_permissionsCan_modify_template = [jResp BoolOf: @"user_permissions.can_modify_template"]; BOOL user_permissionsCan_public_share_presentation = [jResp BoolOf: @"user_permissions.can_public_share_presentation"]; BOOL user_permissionsCan_public_share_review_link = [jResp BoolOf: @"user_permissions.can_public_share_review_link"]; BOOL user_permissionsCan_share_downloadable_presentation = [jResp BoolOf: @"user_permissions.can_share_downloadable_presentation"]; BOOL user_permissionsCan_share_downloadable_review_link = [jResp BoolOf: @"user_permissions.can_share_downloadable_review_link"]; BOOL user_permissionsCan_share_unwatermarked_presentation = [jResp BoolOf: @"user_permissions.can_share_unwatermarked_presentation"]; BOOL user_permissionsCan_share_unwatermarked_review_link = [jResp BoolOf: @"user_permissions.can_share_unwatermarked_review_link"]; BOOL shared = [jResp BoolOf: @"shared"]; BOOL is_360 = [jResp BoolOf: @"is_360"]; v_type = [jResp StringOf: @"_type"]; int comment_count = [[jResp IntOf: @"comment_count"] intValue]; NSString *archived_at = [jResp StringOf: @"archived_at"]; NSString *filetype = [jResp StringOf: @"filetype"]; NSString *id = [jResp StringOf: @"id"]; NSString *hard_deleted_at = [jResp StringOf: @"hard_deleted_at"]; BOOL copy = [jResp BoolOf: @"copy"]; BOOL is_hls_required = [jResp BoolOf: @"is_hls_required"]; NSString *archive_status = [jResp StringOf: @"archive_status"]; NSString *inserted_at = [jResp StringOf: @"inserted_at"]; int filesize = [[jResp IntOf: @"filesize"] intValue]; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.