Box Developerドキュメント

Box Developerドキュメントの新しいベータ版サイトがまもなくリリースされる予定です。最新の開発者向けガイド、APIリファレンス、AI搭載の検索により、Boxを使用した迅速な開発をサポートします。更新情報については今しばらくお待ちください。

最新バージョン

ファイルバージョンを昇格

post
https://api.box.com/2.0
/files/:file_id/versions/current

このエンドポイントはバージョン2024.0です。引き続き使用するために 変更は必要ありません。詳細については、 **Box APIのバージョン管理**を参照してください。

特定のファイルバージョンを昇格させます。

以前のバージョンが存在する場合は、この方法を使用して古いバージョンのいずれかをバージョン履歴の先頭に移動できます。

これにより、古いバージョンの新しいコピーが作成されて、バージョン履歴の先頭に配置されます。このファイルは古いバージョンとまったく同じ内容になり、ハッシュダイジェスト、etag、およびファイル名も同じになります。

コメントなど、他のプロパティが以前の値に更新されることはありません。

このエンドポイントは、PDF、DOC、PPTXなどのファイル形式で機能するため、Box Notesの復元には使用しないでください。

リクエスト

bearer [ACCESS_TOKEN]
application/json

パスパラメータ

stringパス内必須
12345

ファイルを表す一意の識別子。

ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123の場合、file_id123です。

クエリパラメータ

string arrayクエリ内省略可能
id,type,name

レスポンスに含める属性のコンマ区切りリスト。このパラメータを使用すると、標準のレスポンスには通常含まれないフィールドをリクエストできます。

このパラメータを指定すると、明示的に指定しない限り標準フィールドはレスポンスに含まれず、リクエストしたフィールドのほかには、Mini版の表示のフィールドしか返されないことに注意してください。

リクエスト本文

string本文内省略可能
"11446498"

ファイルバージョンID。

string本文内省略可能
"file_version"

昇格させるタイプ。

次の値に固定: file_version

レスポンス

新しく作成されたファイルバージョンオブジェクトを返します。

予期しないクライアントエラー。

post
ファイルバージョンを昇格
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

Box SDKのバージョン戦略の詳細については、 **こちら**を確認してください。


cURL
curl -i -X POST "https://api.box.com/2.0/files/12345/versions/current" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "type": "file_version",
       "id": "456456"
     }'
Node/TypeScript v10
await client.fileVersions.promoteFileVersion(file.id, {
  requestBody: {
    id: fileVersions.entries![0].id,
    type: 'file_version' as PromoteFileVersionRequestBodyTypeField,
  } satisfies PromoteFileVersionRequestBody,
} satisfies PromoteFileVersionOptionalsInput);
Python v10
client.file_versions.promote_file_version(
    file.id, id=file_versions.entries[0].id, type=PromoteFileVersionType.FILE_VERSION
)
.NET v10
await client.FileVersions.PromoteFileVersionAsync(fileId: file.Id, requestBody: new PromoteFileVersionRequestBody() { Id = NullableUtils.Unwrap(fileVersions.Entries)[0].Id, Type = PromoteFileVersionRequestBodyTypeField.FileVersion });
Swift v10
try await client.fileVersions.promoteFileVersion(fileId: file.id, requestBody: PromoteFileVersionRequestBody(id: fileVersions.entries![0].id, type: PromoteFileVersionRequestBodyTypeField.fileVersion))
Java v10
client.getFileVersions().promoteFileVersion(file.getId(), new PromoteFileVersionRequestBody.Builder().id(fileVersions.getEntries().get(0).getId()).type(PromoteFileVersionRequestBodyTypeField.FILE_VERSION).build())
.NET v6
await client.FileVersions.PromoteFileVersionAsync(fileId: file.Id, requestBody: new PromoteFileVersionRequestBody() { Id = NullableUtils.Unwrap(fileVersions.Entries)[0].Id, Type = PromoteFileVersionRequestBodyTypeField.FileVersion });
Node v4
await client.fileVersions.promoteFileVersion(file.id, {
  requestBody: {
    id: fileVersions.entries![0].id,
    type: 'file_version' as PromoteFileVersionRequestBodyTypeField,
  } satisfies PromoteFileVersionRequestBody,
} satisfies PromoteFileVersionOptionalsInput);

レスポンスの例

{
  "id": "12345",
  "type": "file_version",
  "created_at": "2012-12-12T10:53:43-08:00",
  "modified_at": "2012-12-12T10:53:43-08:00",
  "modified_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "name": "tigers.jpeg",
  "purged_at": "2012-12-12T10:53:43-08:00",
  "restored_at": "2012-12-12T10:53:43-08:00",
  "restored_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
  "size": 629644,
  "trashed_at": "2012-12-12T10:53:43-08:00",
  "trashed_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "uploader_display_name": "Ellis Wiggins",
  "version_number": "1"
}