حذف فایل
هشدار
در صورت حذف، امکان بازیابی فایل وجود ندارد.
مولفه ها
- کلید های دسترسی (اجباری)
- آیدی فایل (اجباری)
Key | Type | Required | In | Example |
---|---|---|---|---|
fileId | string | true | body | - |
- CURL
- Node.js
- Python
- GO
- PHP
curl -X 'DELETE' \
'https://api.vidprotect.ir/v1/storage/bucket/file' \
-H 'accept: application/json' \
-H 'api_key: your_api_key' \
-H 'secret_key: your_secret_key' \
-H 'Content-Type: application/json' \
-d '{
"fileId": "_id"
}'
const superagent = require('superagent');
superagent('DELETE', 'https://api.vidprotect.ir/v1/storage/bucket/file')
.set('api_key', 'your_api_key')
.set('secret_key', 'your_secret_key')
.send({
fileId: '_id'
})
.then(data => console.log(data.body))
.catch(console.log);
import requests
url = 'https://api.vidprotect.ir/v1/storage/bucket/file'
headers = {
'api_key': 'your_api_key',
'secret_key': 'your_secret_key'
}
payload = {
'fileId': '_id'
}
try:
response = requests.delete(url, headers=headers, json=payload)
response.raise_for_status()
data = response.json()
print(data)
except requests.exceptions.RequestException as e:
print('Error:', e)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.vidprotect.ir/v1/storage/bucket/file"
apiKey := "your_api_key"
secretKey := "your_secret_key"
data := map[string]string{
"fileId": "_id",
}
jsonData, _ := json.Marshal(data)
req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api_key", apiKey)
req.Header.Set("secret_key", secretKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
<?php
$url = 'https://api.vidprotect.ir/v1/storage/bucket/file';
$data = [
'fileId' => '_id'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'api_key: your_api_key',
'secret_key: your_secret_key'
]);
$json_data = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if(curl_errno($ch)){
echo 'Curl error: ' . curl_error($ch);
}
curl_close($ch);
echo $response;
?>