Delete File
ποΈ Delete Order by Order ID
Use this endpoint to delete all files associated with a specific order by providing an order_id
.
π Request Parameters
- order_id (string): The unique identifier for the order whose files you wish to delete.
π Response
The response will confirm whether all files associated with the specified order_id
were successfully deleted.
β οΈ Ensure the order_id
is valid before making this request.
import requests
order_id = "your_order_id" # Replace with your order ID
api_key = "your_api_key" # Replace with your API key
url = f"https://api.tor.app/developer/files/{order_id}"
headers = {
"Authorization": f"Bearer {api_key}"
}
response = requests.delete(url, headers=headers)
if response.status_code == 200:
print("Order deleted successfully.")
else:
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const orderId = "your_order_id"; // Replace with your order ID
const apiKey = "your_api_key"; // Replace with your API key
const url = `https://api.tor.app/developer/files/${orderId}`;
axios.delete(url, {
headers: {
"Authorization": `Bearer ${apiKey}`
}
}).then(response => {
console.log("Order deleted successfully.");
}).catch(error => {
console.error("Error:", error.response ? error.response.data : error.message);
});
import okhttp3.*;
public class DeleteOrder {
public static void main(String[] args) throws Exception {
String orderId = "your_order_id"; // Replace with your order ID
String apiKey = "your_api_key"; // Replace with your API key
OkHttpClient client = new OkHttpClient();
String url = "https://api.tor.app/developer/files/" + orderId;
Request request = new Request.Builder()
.url(url)
.delete()
.addHeader("Authorization", "Bearer " + apiKey)
.build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
System.out.println("Order deleted successfully.");
} else {
System.out.println("Error: " + response.code());
}
}
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class Program
{
private static readonly string orderId = "your_order_id"; // Replace with your order ID
private static readonly string apiKey = "your_api_key"; // Replace with your API key
public static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
var url = $"https://api.tor.app/developer/files/{orderId}";
var response = await client.DeleteAsync(url);
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Order deleted successfully.");
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
}
}
}
package main
import (
"fmt"
"net/http"
)
const (
apiKey = "your_api_key" // Replace with your API key
orderId = "your_order_id" // Replace with your order ID
)
func main() {
url := fmt.Sprintf("https://api.tor.app/developer/files/%s", orderId)
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer "+apiKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
fmt.Println("Order deleted successfully.")
} else {
fmt.Printf("Error: %d\n", resp.StatusCode)
}
}
require 'net/http'
require 'uri'
order_id = "your_order_id" # Replace with your order ID
api_key = "your_api_key" # Replace with your API key
url = URI("https://api.tor.app/developer/files/#{order_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = "Bearer #{api_key}"
response = http.request(request)
if response.code.to_i == 200
puts "Order deleted successfully."
else
puts "Error: #{response.code}"
end
<?php
$orderId = "your_order_id"; // Replace with your order ID
$apiKey = "your_api_key"; // Replace with your API key
$url = "https://api.tor.app/developer/files/$orderId";
$headers = [
"Authorization: Bearer $apiKey"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode == 200) {
echo "Order deleted successfully.";
} else {
echo "Error: $httpCode\n";
}
?>
import okhttp3.OkHttpClient
import okhttp3.Request
fun main() {
val apiKey = "your_api_key" // Replace with your API key
val orderId = "your_order_id" // Replace with your order ID
val client = OkHttpClient()
val url = "https://api.tor.app/developer/files/$orderId"
val request = Request.Builder()
.url(url)
.delete()
.addHeader("Authorization", "Bearer $apiKey")
.build()
client.newCall(request).execute().use { response ->
if (response.isSuccessful) {
println("Order deleted successfully.")
} else {
println("Error: ${response.code}")
}
}
}
import Foundation
let orderId = "your_order_id" // Replace with your order ID
let apiKey = "your_api_key" // Replace with your API key
let url = URL(string: "https://api.tor.app/developer/files/\(orderId)")!
var request = URLRequest(url: url)
request.httpMethod = "DELETE"
request.addValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let httpResponse = response as? HTTPURLResponse else {
print("Request failed:", error ?? "Unknown error")
return
}
if httpResponse.statusCode == 200 {
print("Order deleted successfully.")
} else {
print("Error: \(httpResponse.statusCode)")
}
}
task.resume()
import 'dart:convert';
import 'dart:io';
void main() async {
const orderId = "your_order_id"; // Replace with your order ID
const apiKey = "your_api_key"; // Replace with your API key
final url = Uri.parse("https://api.tor.app/developer/files/$orderId");
final request = await HttpClient().deleteUrl(url)
..headers.set("Authorization", "Bearer $apiKey");
final response = await request.close();
if (response.statusCode == 200) {
print("Order deleted successfully.");
} else {
print("Error: ${response.statusCode}");
}
}
Updated 13 days ago