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
(PureBasic) 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
IncludeFile "CkHttpResponse.pb" IncludeFile "CkHttp.pb" IncludeFile "CkStringBuilder.pb" IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i ; 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" ; } json.i = CkJsonObject::ckCreate() If json.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckUpdateString(json,"type","folder") CkJsonObject::ckUpdateString(json,"name","Folder at root") CkHttp::ckSetRequestHeader(http,"content-type","application/json") ; Adds the "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" header. CkHttp::setCkAuthToken(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. resp.i = CkHttp::ckPostJson3(http,"https://api.frame.io/v2/assets/4ecb383f-71a8-4233-b665-d8f75136f554/children","application/json",json) If CkHttp::ckLastMethodSuccess(http) = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkJsonObject::ckDispose(json) ProcedureReturn EndIf sbResponseBody.i = CkStringBuilder::ckCreate() If sbResponseBody.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkHttpResponse::ckGetBodySb(resp,sbResponseBody) jResp.i = CkJsonObject::ckCreate() If jResp.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckLoadSb(jResp,sbResponseBody) CkJsonObject::setCkEmitCompact(jResp, 0) Debug "Response Body:" Debug CkJsonObject::ckEmit(jResp) respStatusCode.i = CkHttpResponse::ckStatusCode(resp) Debug "Response Status Code = " + Str(respStatusCode) If respStatusCode >= 400 Debug "Response Header:" Debug CkHttpResponse::ckHeader(resp) Debug "Failed." CkHttpResponse::ckDispose(resp) CkHttp::ckDispose(http) CkJsonObject::ckDispose(json) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn EndIf CkHttpResponse::ckDispose(resp) ; 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 team_id.s = CkJsonObject::ckStringOf(jResp,"team_id") public_item_count.i = CkJsonObject::ckIntOf(jResp,"public_item_count") properties.s = CkJsonObject::ckStringOf(jResp,"properties") deleted_at.s = CkJsonObject::ckStringOf(jResp,"deleted_at") fps.s = CkJsonObject::ckStringOf(jResp,"fps") rating.s = CkJsonObject::ckStringOf(jResp,"rating") description.s = CkJsonObject::ckStringOf(jResp,"description") updated_at.s = CkJsonObject::ckStringOf(jResp,"updated_at") cover_asset_id.s = CkJsonObject::ckStringOf(jResp,"cover_asset_id") archive_scheduled_at.s = CkJsonObject::ckStringOf(jResp,"archive_scheduled_at") subtitle_tracks.s = CkJsonObject::ckStringOf(jResp,"subtitle_tracks") index.s = CkJsonObject::ckStringOf(jResp,"index") item_count.i = CkJsonObject::ckIntOf(jResp,"item_count") account_id.s = CkJsonObject::ckStringOf(jResp,"account_id") name.s = CkJsonObject::ckStringOf(jResp,"name") checksums.s = CkJsonObject::ckStringOf(jResp,"checksums") audio_tracks.s = CkJsonObject::ckStringOf(jResp,"audio_tracks") duration.s = CkJsonObject::ckStringOf(jResp,"duration") label.s = CkJsonObject::ckStringOf(jResp,"label") is_session_watermarked.i = CkJsonObject::ckBoolOf(jResp,"is_session_watermarked") parent_id.s = CkJsonObject::ckStringOf(jResp,"parent_id") versions.i = CkJsonObject::ckIntOf(jResp,"versions") project_id.s = CkJsonObject::ckStringOf(jResp,"project_id") resource_id.s = CkJsonObject::ckStringOf(jResp,"resource_id") v_private.i = CkJsonObject::ckBoolOf(jResp,"private") frames.i = CkJsonObject::ckIntOf(jResp,"frames") autoversion_id.s = CkJsonObject::ckStringOf(jResp,"autoversion_id") v_type.s = CkJsonObject::ckStringOf(jResp,"type") uploaded_at.s = CkJsonObject::ckStringOf(jResp,"uploaded_at") creator_id.s = CkJsonObject::ckStringOf(jResp,"creator_id") user_permissionsCan_download.i = CkJsonObject::ckBoolOf(jResp,"user_permissions.can_download") user_permissionsCan_modify_template.i = CkJsonObject::ckBoolOf(jResp,"user_permissions.can_modify_template") user_permissionsCan_public_share_presentation.i = CkJsonObject::ckBoolOf(jResp,"user_permissions.can_public_share_presentation") user_permissionsCan_public_share_review_link.i = CkJsonObject::ckBoolOf(jResp,"user_permissions.can_public_share_review_link") user_permissionsCan_share_downloadable_presentation.i = CkJsonObject::ckBoolOf(jResp,"user_permissions.can_share_downloadable_presentation") user_permissionsCan_share_downloadable_review_link.i = CkJsonObject::ckBoolOf(jResp,"user_permissions.can_share_downloadable_review_link") user_permissionsCan_share_unwatermarked_presentation.i = CkJsonObject::ckBoolOf(jResp,"user_permissions.can_share_unwatermarked_presentation") user_permissionsCan_share_unwatermarked_review_link.i = CkJsonObject::ckBoolOf(jResp,"user_permissions.can_share_unwatermarked_review_link") shared.i = CkJsonObject::ckBoolOf(jResp,"shared") is_360.i = CkJsonObject::ckBoolOf(jResp,"is_360") v_type = CkJsonObject::ckStringOf(jResp,"_type") comment_count.i = CkJsonObject::ckIntOf(jResp,"comment_count") archived_at.s = CkJsonObject::ckStringOf(jResp,"archived_at") filetype.s = CkJsonObject::ckStringOf(jResp,"filetype") id.s = CkJsonObject::ckStringOf(jResp,"id") hard_deleted_at.s = CkJsonObject::ckStringOf(jResp,"hard_deleted_at") copy.i = CkJsonObject::ckBoolOf(jResp,"copy") is_hls_required.i = CkJsonObject::ckBoolOf(jResp,"is_hls_required") archive_status.s = CkJsonObject::ckStringOf(jResp,"archive_status") inserted_at.s = CkJsonObject::ckStringOf(jResp,"inserted_at") filesize.i = CkJsonObject::ckIntOf(jResp,"filesize") CkHttp::ckDispose(http) CkJsonObject::ckDispose(json) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.