ファイルの以前のバージョンを復元します。
以前のバージョンが存在する場合は、この方法を使用して古いバージョンのいずれかをバージョン履歴の先頭に移動できます。
実際には、古いバージョンの新しいコピーが作成されて、バージョン履歴の先頭に配置されます。このファイルは古いバージョンとまったく同じ内容になり、ハッシュダイジェスト、etag
、およびファイル名も同じになります。
コメントなど、他のプロパティが以前の値に更新されることはありません。
12345
ファイルを表す一意の識別子。
ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123
の場合、file_id
は123
です。
id,type,name
応答に含める属性のカンマ区切りリスト。このパラメータを使用すると、標準の応答には通常含まれないフィールドをリクエストできます。
このパラメータを指定すると、明示的に指定しない限り標準フィールドは応答に含まれず、リクエストしたフィールドのほかには、簡易版レプリゼンテーションのフィールドしか返されないことに注意してください。
11446498
ファイルバージョンID
file_version
次の値に固定: file_version
curl -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"
}'
string fileId = "11111";
BoxFileVersion current = await client.FilesManager.PromoteVersionAsync(fileId, versionId: "22222");
BoxFile file = new BoxFile(api, "id");
List<BoxFileVersion> versions = file.getVersions();
BoxFileVersion firstVersion = versions.get(0);
firstVersion.promote();
file_id = '11111'
file_version_id = '12345'
version_to_promote = client.file_version(file_version_id)
new_version = client.file(file_id).promote_version(version_to_promote)
print('Version {0} promoted; new version {1} created'.format(file_version_id, new_version.id))
var fileID = '11111';
var versionID = '22222';
client.files.promoteVersion(fileID, versionID)
.then(version => {
/* version -> {
type: 'file_version',
id: '33333',
sha1: '12039d6dd9a7e6eefc78846802e',
name: 'Stark Family Lineage.pptx',
size: 37934912,
created_at: '2013-11-20T13:20:50-08:00',
modified_at: '2013-11-20T13:26:48-08:00',
modified_by:
{ type: 'user',
id: '44444',
name: 'Eddard Stark',
login: 'ned@winterfell.example.com' } }
*/
});