Delete a File |
Deletes a file. When a file is deleted, all versions of the file are marked as deleted. Files that are marked as deleted are typically hidden from queries.
A deleted file is not fully removed until the Purge a File command is called. A file that is deleted but not purged can be restored by using the Restore a Deleted File command.
Note: For more information about this command, including descriptions of any path and request parameters, request body schema, response codes and schemas, and payload examples, refer to the online API reference for this command at the following web page: |
URI
https://bartendercloud.com/api/librarian/files/{fileId}/delete
Note: The bartendercloud.com domain that is referenced in the URI and in the code example that follows must be replaced with the contents of the DataCenterURI claim that is extracted from your access token. For more information, refer to Extracting the DataCenterURI Claim. |
Path Parameters
fileId
Type: String
Specifies the ID of the file to delete. Required.
Query Parameters
None.
Example
- C#
Request body: See FileUpdateRequest.
Response: A FileChange object is returned that provides details about the file.
// Assume that fileId is the ID of the target file.
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var request = new FileUpdateRequest() {
Comment = "Deleting SQL File"
};
HttpRequestMessage request = new HttpRequestMessage(new HttpMethod("PATCH"), new Uri($"https://bartendercloud.com/api/librarian/files/{fileId}/delete"))
{
Content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json")
};
HttpResponseMessage msg = await client.SendAsync(request);
if (msg.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<FileChange>(await msg.Content.ReadAsStringAsync());
}