Join a webinar on April 30th: Unlocking Your Data using AI with Box Extract & MCP Server. Register here
curl -i -X PUT "https://api.box.com/2.0/files/12345" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"name": "New name"
}'{
"id": "12345",
"type": "file",
"etag": "1",
"sequence_id": "3",
"name": "Contract.pdf",
"sha1": "85136C79CBF9FE36BB9D05D0639C70C265C18D37",
"file_version": {
"id": "12345",
"type": "file_version",
"sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
},
"description": "Contract for Q1 renewal",
"size": 629644,
"path_collection": {
"total_count": 1,
"entries": [
{
"id": "12345",
"type": "folder",
"etag": "1",
"sequence_id": "3",
"name": "Contracts"
}
]
},
"created_at": "2012-12-12T10:53:43-08:00",
"modified_at": "2012-12-12T10:53:43-08:00",
"trashed_at": "2012-12-12T10:53:43-08:00",
"purged_at": "2012-12-12T10:53:43-08:00",
"content_created_at": "2012-12-12T10:53:43-08:00",
"content_modified_at": "2012-12-12T10:53:43-08:00",
"created_by": {
"id": "11446498",
"type": "user",
"name": "Aaron Levie",
"login": "ceo@example.com"
},
"modified_by": {
"id": "11446498",
"type": "user",
"name": "Aaron Levie",
"login": "ceo@example.com"
},
"owned_by": {
"id": "11446498",
"type": "user",
"name": "Aaron Levie",
"login": "ceo@example.com"
},
"shared_link": {
"url": "https://www.box.com/s/vspke7y05sb214wjokpk",
"effective_access": "company",
"effective_permission": "can_download",
"is_password_enabled": true,
"download_count": 3,
"preview_count": 3,
"download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
"vanity_url": "https://acme.app.box.com/v/my_url/",
"vanity_name": "my_url",
"access": "open",
"unshared_at": "2018-04-13T13:53:23-07:00",
"permissions": {
"can_download": true,
"can_preview": true,
"can_edit": false
}
},
"parent": {
"id": "12345",
"type": "folder",
"etag": "1",
"sequence_id": "3",
"name": "Contracts"
},
"item_status": "active",
"version_number": "1",
"comment_count": 10,
"permissions": {
"can_delete": true,
"can_download": true,
"can_invite_collaborator": true,
"can_rename": true,
"can_set_share_access": true,
"can_share": true,
"can_annotate": true,
"can_comment": true,
"can_preview": true,
"can_upload": true,
"can_view_annotations_all": true,
"can_view_annotations_self": true,
"can_apply_watermark": true
},
"tags": [
"approved"
],
"lock": {
"id": "11446498",
"type": "lock",
"created_by": {
"id": "11446498",
"type": "user",
"name": "Aaron Levie",
"login": "ceo@example.com"
},
"created_at": "2012-12-12T10:53:43-08:00",
"expired_at": "2012-12-12T10:53:43-08:00",
"is_download_prevented": true,
"app_type": "office_wopiplus"
},
"extension": "pdf",
"is_package": true,
"expiring_embed_link": {
"access_token": "c3FIOG9vSGV4VHo4QzAyg5T1JvNnJoZ3ExaVNyQWw6WjRsanRKZG5lQk9qUE1BVQ",
"expires_in": 3600,
"token_type": "bearer",
"restricted_to": [
{
"scope": "item_download",
"object": {
"id": "12345",
"type": "folder",
"etag": "1",
"sequence_id": "3",
"name": "Contracts"
}
}
],
"url": "https://cloud.app.box.com/preview/expiring_embed/..."
},
"watermark_info": {
"is_watermarked": true,
"is_watermark_inherited": false,
"is_watermarked_by_access_policy": false
},
"is_accessible_via_shared_link": true,
"allowed_invitee_roles": [
"editor"
],
"is_externally_owned": true,
"has_collaborations": true,
"metadata": {
"enterprise_27335": {
"marketingCollateral": {
"$canEdit": true,
"$id": "01234500-12f1-1234-aa12-b1d234cb567e",
"$parent": "folder_59449484661",
"$scope": "enterprise_27335",
"$template": "marketingCollateral",
"$type": "properties-6bcba49f-ca6d-4d2a-a758-57fe6edf44d0",
"$typeVersion": 2,
"$version": 1
}
}
},
"expires_at": "2012-12-12T10:53:43-08:00",
"representations": {
"entries": [
{
"content": {
"url_template": "https://dl.boxcloud.com/api/2.0/internal_files/123/versions/345/representations/png_paged_2048x2048/content/{+asset_path}?watermark_content=4567"
},
"info": {
"url": "https://api.box.com/2.0/internal_files/123/versions/345/representations/png_paged_2048x2048"
},
"properties": {
"dimensions": "2048x2048",
"paged": "true",
"thumb": "true"
},
"representation": "png",
"status": {
"state": "success"
}
}
]
},
"classification": {
"name": "Top Secret",
"definition": "Content that should not be shared outside the company.",
"color": "#FF0000"
},
"uploader_display_name": "Ellis Wiggins",
"disposition_at": "2012-12-12T10:53:43-08:00",
"shared_link_permission_options": [
"can_preview"
],
"is_associated_with_app_item": true
}ファイルを更新します。ファイルの名前変更や移動、共有リンクの作成、ファイルのロックといった目的に使用できます。
curl -i -X PUT "https://api.box.com/2.0/files/12345" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"name": "New name"
}'{
"id": "12345",
"type": "file",
"etag": "1",
"sequence_id": "3",
"name": "Contract.pdf",
"sha1": "85136C79CBF9FE36BB9D05D0639C70C265C18D37",
"file_version": {
"id": "12345",
"type": "file_version",
"sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
},
"description": "Contract for Q1 renewal",
"size": 629644,
"path_collection": {
"total_count": 1,
"entries": [
{
"id": "12345",
"type": "folder",
"etag": "1",
"sequence_id": "3",
"name": "Contracts"
}
]
},
"created_at": "2012-12-12T10:53:43-08:00",
"modified_at": "2012-12-12T10:53:43-08:00",
"trashed_at": "2012-12-12T10:53:43-08:00",
"purged_at": "2012-12-12T10:53:43-08:00",
"content_created_at": "2012-12-12T10:53:43-08:00",
"content_modified_at": "2012-12-12T10:53:43-08:00",
"created_by": {
"id": "11446498",
"type": "user",
"name": "Aaron Levie",
"login": "ceo@example.com"
},
"modified_by": {
"id": "11446498",
"type": "user",
"name": "Aaron Levie",
"login": "ceo@example.com"
},
"owned_by": {
"id": "11446498",
"type": "user",
"name": "Aaron Levie",
"login": "ceo@example.com"
},
"shared_link": {
"url": "https://www.box.com/s/vspke7y05sb214wjokpk",
"effective_access": "company",
"effective_permission": "can_download",
"is_password_enabled": true,
"download_count": 3,
"preview_count": 3,
"download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
"vanity_url": "https://acme.app.box.com/v/my_url/",
"vanity_name": "my_url",
"access": "open",
"unshared_at": "2018-04-13T13:53:23-07:00",
"permissions": {
"can_download": true,
"can_preview": true,
"can_edit": false
}
},
"parent": {
"id": "12345",
"type": "folder",
"etag": "1",
"sequence_id": "3",
"name": "Contracts"
},
"item_status": "active",
"version_number": "1",
"comment_count": 10,
"permissions": {
"can_delete": true,
"can_download": true,
"can_invite_collaborator": true,
"can_rename": true,
"can_set_share_access": true,
"can_share": true,
"can_annotate": true,
"can_comment": true,
"can_preview": true,
"can_upload": true,
"can_view_annotations_all": true,
"can_view_annotations_self": true,
"can_apply_watermark": true
},
"tags": [
"approved"
],
"lock": {
"id": "11446498",
"type": "lock",
"created_by": {
"id": "11446498",
"type": "user",
"name": "Aaron Levie",
"login": "ceo@example.com"
},
"created_at": "2012-12-12T10:53:43-08:00",
"expired_at": "2012-12-12T10:53:43-08:00",
"is_download_prevented": true,
"app_type": "office_wopiplus"
},
"extension": "pdf",
"is_package": true,
"expiring_embed_link": {
"access_token": "c3FIOG9vSGV4VHo4QzAyg5T1JvNnJoZ3ExaVNyQWw6WjRsanRKZG5lQk9qUE1BVQ",
"expires_in": 3600,
"token_type": "bearer",
"restricted_to": [
{
"scope": "item_download",
"object": {
"id": "12345",
"type": "folder",
"etag": "1",
"sequence_id": "3",
"name": "Contracts"
}
}
],
"url": "https://cloud.app.box.com/preview/expiring_embed/..."
},
"watermark_info": {
"is_watermarked": true,
"is_watermark_inherited": false,
"is_watermarked_by_access_policy": false
},
"is_accessible_via_shared_link": true,
"allowed_invitee_roles": [
"editor"
],
"is_externally_owned": true,
"has_collaborations": true,
"metadata": {
"enterprise_27335": {
"marketingCollateral": {
"$canEdit": true,
"$id": "01234500-12f1-1234-aa12-b1d234cb567e",
"$parent": "folder_59449484661",
"$scope": "enterprise_27335",
"$template": "marketingCollateral",
"$type": "properties-6bcba49f-ca6d-4d2a-a758-57fe6edf44d0",
"$typeVersion": 2,
"$version": 1
}
}
},
"expires_at": "2012-12-12T10:53:43-08:00",
"representations": {
"entries": [
{
"content": {
"url_template": "https://dl.boxcloud.com/api/2.0/internal_files/123/versions/345/representations/png_paged_2048x2048/content/{+asset_path}?watermark_content=4567"
},
"info": {
"url": "https://api.box.com/2.0/internal_files/123/versions/345/representations/png_paged_2048x2048"
},
"properties": {
"dimensions": "2048x2048",
"paged": "true",
"thumb": "true"
},
"representation": "png",
"status": {
"state": "success"
}
}
]
},
"classification": {
"name": "Top Secret",
"definition": "Content that should not be shared outside the company.",
"color": "#FF0000"
},
"uploader_display_name": "Ellis Wiggins",
"disposition_at": "2012-12-12T10:53:43-08:00",
"shared_link_permission_options": [
"can_preview"
],
"is_associated_with_app_item": true
}The access token received from the authorization server in the OAuth 2.0 flow.
変更を加える前にこの項目が最近変更されていないことを確認します。
その項目の最後に認識されたetag値をこのヘッダーに渡すと、それ以降に項目が変更されている場合、エンドポイントは412 Precondition Failedを返して失敗します。
ファイルを表す一意の識別子。
ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123の場合、file_idは123です。
レスポンスに含める属性のコンマ区切りリスト。このパラメータを使用すると、標準のレスポンスには通常含まれないフィールドをリクエストできます。
このパラメータを指定すると、明示的に指定しない限り標準フィールドはレスポンスに含まれず、リクエストしたフィールドのほかには、Mini版の表示のフィールドしか返されないことに注意してください。
ファイルの別の名前 (省略可)。これを使用してファイルの名前を変更できます。
ファイル名はその親フォルダ内で一意である必要があります。名前のチェックでは大文字と小文字が区別されないため、New Fileという名前のファイルは、new fileというフォルダがすでに含まれている親フォルダ内に作成できません。
"NewFile.txt"
ファイルの説明。Boxウェブアプリでファイルを表示すると、右側のサイドバーパネルに表示されます。さらに、このインデックスはファイルの検索インデックスで使用されるため、ユーザーは説明の内容でファイルを見つけることができます。
256"The latest reports. Automatically updated"
ファイルの新しい親フォルダ (省略可)。これを使用して、ファイルを新しいフォルダに移動できます。
Show child attributes
ファイルの共有リンクを定義します。これをnullに設定すると、共有リンクが削除されます。
Show child attributes
項目のロックを定義します。これにより、ロックを作成したユーザー以外は、この項目を移動、名前変更、および変更できなくなります。
これをnullに設定すると、ロックが削除されます。
Show child attributes
特定のファイルのリテンションの有効期限のタイムスタンプ。この日付は、一度ファイルに設定すると短縮できません。
"2012-12-12T10:53:43-08:00"
ファイルをダウンロードできるユーザーを定義します。
Show child attributes
このファイルをメンバーとして追加するコレクションの配列。現時点では、favoritesコレクションのみがサポートされています。
コレクションのIDを取得するには、すべてのコレクションのリストを取得エンドポイントを使用します。
空の配列[]またはnullを渡すと、すべてのコレクションからこのファイルが削除されます。
Show child attributes
この項目のタグ。これらのタグはBoxウェブアプリおよびモバイルアプリで項目の横に表示されます。
タグを追加または削除するには、項目の現在のタグを取得して変更してから、このフィールドを更新します。
タグの数は、1項目あたり100個までに制限され、一意のタグは会社あたり10,000個までに制限されます。
1 - 100 elements["approved"]ファイルオブジェクトを返します。
使用可能なすべてのフィールドがデフォルトで返されるとは限りません。特定のフィールドを明示的にリクエストするには、fieldsクエリパラメータを使用します。
任意のファイルAPIエンドポイントからデフォルトで返される可能性があるファイルのFull版の表示。
ファイルを表す一意の識別子。
ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123の場合、file_idは123です。
"12345"
値は常にfileになります。
file "file"
このファイルのHTTP etag。これは変更が発生した場合 (またはしなかった場合) にファイルに対して変更を行う目的でのみ、If-MatchおよびIf-None-Matchヘッダー内の一部のAPIエンドポイントで使用できます。
"1"
この項目に適用された最新のUser Eventを表す数値の識別子。
これをGET /eventsエンドポイントと組み合わせて使用すると、この識別子が読み取られる前に発生した可能性があるUser Eventを除外できます。
たとえば、Box DriveなどのアプリケーションがAPIを介して項目を取得し、その項目の変更に関連するUser Eventの発生を監視する場合などがこれに該当します。User Eventのsequence_idが最初に取得されたリソースのsequence_idよりも小さいか同じである場合、アプリケーションはそのようなUser Eventをすべて無視します。
"3"
ファイルの名前。
"Contract.pdf"
ファイルのSHA1ハッシュ。Box上のファイルとローカルファイルの内容を比較する目的に使用できます。
"85136C79CBF9FE36BB9D05D0639C70C265C18D37"
ファイルの現在のバージョンに関する情報。
Show child attributes
このファイルの説明 (省略可)。説明が255文字を超える場合は、最初の255文字がファイルの説明として設定され、残りは無視されます。
255"Contract for Q1 renewal"
ファイルサイズ (バイト単位)。この整数を解析する際には、非常に大きな数値となって整数オーバーフローになる可能性があるため、注意が必要です。
629644
ルートフォルダを起点にした、このファイルを含むフォルダツリー。
Show child attributes
Box上でこのファイルが作成された日時。
"2012-12-12T10:53:43-08:00"
Boxでこのファイルが最後に更新された日時。
"2012-12-12T10:53:43-08:00"
このファイルがごみ箱に移動された日時。
"2012-12-12T10:53:43-08:00"
このファイルがごみ箱から削除される予定日時。
"2012-12-12T10:53:43-08:00"
このファイルが最初に作成された日時。この日時はファイルがBoxにアップロードされた時点よりも前になる場合があります。
"2012-12-12T10:53:43-08:00"
このファイルが最後に更新された日時。この日時はファイルがBoxにアップロードされた時点よりも前になる場合があります。
"2012-12-12T10:53:43-08:00"
このファイルを作成したユーザー。
Show child attributes
このファイルを最後に変更したユーザー。
Show child attributes
このファイルを所有するユーザー。
Show child attributes
このファイルの共有リンク。このファイルに対してまだ共有リンクが作成されていない場合、この値はnullになります。
Show child attributes
このフォルダが配置されているフォルダ。ルートフォルダやごみ箱フォルダなど、一部のフォルダの場合、この値はnullになる可能性があります。
Show child attributes
この項目が削除されたかどうかを定義します。
active - 項目がごみ箱に移動されていない場合。trashed - 項目がごみ箱に移動されているが、まだ削除されていない場合。deleted - 項目がすでに完全に削除されている場合。active, trashed, deleted "active"
このファイルのバージョン番号。
"1"
このファイルに関するコメントの数。
10
このファイルに対して現在のユーザーが持っている権限について説明します。
Show child attributes
この項目のタグ。これらのタグはBoxウェブアプリおよびモバイルアプリで項目の横に表示されます。
タグを追加または削除するには、項目の現在のタグを取得して変更してから、このフィールドを更新します。
タグの数は、1項目あたり100個までに制限され、一意のタグは会社あたり10,000個までに制限されます。
1 - 100 elements["approved"]このファイルで保持されているロック。ロックが存在しない場合はnullになるか、過去のタイムスタンプになります。
Show child attributes
このファイルのファイル拡張子 (省略可) を示します。デフォルトでは、空の文字列に設定されます。
"pdf"
ファイルがパッケージかどうかを示します。パッケージはMacアプリケーションで一般的に使用され、iWorkファイルを含めることができます。
true
このフィールドをリクエストすると、iframeに埋め込まれたプレビューセッション用の有効期限付きBox Embed URLが作成されます。
このURLは60秒後に有効期限切れとなり、セッションはその60分後に有効期限切れとなります。
一部のファイルタイプは、これらの埋め込みURLでサポートされていません。Box Embedはモバイルブラウザ向けに最適化されていないため、モバイルデバイス用に設計されたウェブエクスペリエンスでは使用しないでください。多くのUI Element (ダウンロードオプションや印刷オプションなど) はモバイルブラウザに表示されない可能性があります。
Show child attributes
このファイルに適用された電子すかしに関する詳細。
Show child attributes
直接共有リンクまたは親フォルダへの共有リンクを使用してファイルにアクセスできるかどうかを指定します。
true
このファイルを共有するときに招待できるユーザーの役割タイプのリスト。
editor, viewer, previewer, uploader, previewer uploader, viewer uploader, co-owner ["editor"]このファイルが認証済みの会社以外のユーザーによって所有されているかどうかを指定します。
true
このファイルに他のコラボレータが存在するかどうかを指定します。
true
このファイルに追加されたメタデータインスタンスを含むオブジェクト。
各メタデータインスタンスは、そのscopeとtemplateKeyによって一意に識別されます。各ファイルに追加されるメタデータテンプレートのインスタンスは1つだけです。各メタデータインスタンスは、キーとしてtemplateKeyが指定されているオブジェクト内にネストされ、さらにそのオブジェクト自体もキーとしてscopeが指定されているオブジェクト内にネストされます。
Show child attributes
{
"enterprise_27335": {
"marketingCollateral": {
"$canEdit": true,
"$id": "01234500-12f1-1234-aa12-b1d234cb567e",
"$parent": "folder_59449484661",
"$scope": "enterprise_27335",
"$template": "marketingCollateral",
"$type": "properties-6bcba49f-ca6d-4d2a-a758-57fe6edf44d0",
"$typeVersion": 2,
"$version": 1
}
}
}ファイルが自動的に削除される日時。
"2012-12-12T10:53:43-08:00"
アプリケーション内でファイルのプレースホルダを表示するために使用できるレプリゼンテーションのリスト。デフォルトでは、すべてのレプリゼンテーションが返されるため、x-rep-hintsヘッダーを使用して目的のレプリゼンテーションをさらにカスタマイズすることをお勧めします。
Show child attributes
このファイルに適用された分類に関する詳細
Show child attributes
ファイルをアップロードしたユーザーの表示名。ほとんどの場合、これはアップロード時点でログインしているユーザーの名前です。
このファイルのアップロードに、ユーザーに対してメールアドレスの入力を要求するファイルリクエストフォームが使用された場合、このフィールドにはそのメールアドレスが設定されます。メールアドレスがファイルリクエストフォームで要求されなかった場合、このフィールドは、File Requestという値を返すように設定されます。
メールアドレスが指定されなかったその他すべての匿名のケースでは、このフィールドの値がデフォルトでSomeoneになります。
"Ellis Wiggins"
特定のファイルのリテンションの有効期限のタイムスタンプ。
"2012-12-12T10:53:43-08:00"
このファイルを共有するときに招待できるユーザーの役割タイプのリスト。
can_preview, can_download, can_edit ["can_preview"]ファイルまたはファイルの先祖が1つ以上のアプリ項目に関連付けられている場合、このフィールドはtrueを返します。コンテキストユーザーがそのファイルに関連付けられたアプリ項目にアクセスできない場合でもtrueが返されることに注意してください。
true
このページは役に立ちましたか?