Skip to content

DeleteFileVersion

Craig edited this page Mar 1, 2024 · 1 revision

How To Use

<?php

use TechKat\BackBlazeB2\Client;

$keyID = '...';
$applicationKey = '...';

$client = new Client($keyID, $applicationKey);

$response = $client->deleteFileVersion([
  'fileName' => 'file.ext',
  'fileId' => '4_BACKBLAZE_FILE_ID',
  'bypassGovernance' => false,
]);

return $response;

Expected Result

This method will delete a file's version, for example: 10 .zip files in the same folder sharing the same name for the purpose of compressing a file for backup. Each zip file has a unique difference in each of them. You wish to remove the oldest one in the version hierarchy. Each of the 10 .zip files will have their own unique fileId set by BackBlaze but all share the same fileName.

The API response is the fileId and fileName of the file deleted.

{
  "fileId": "4_BACKBLAZE_FILE_ID",
  "fileName": "file.ext"
}

Backblaze B2 API Documentation

https://www.backblaze.com/apidocs/b2-delete-file-version