Vai al contenuto principale
DELETE
/
v1
/
objects
Blob Delete Objects
curl --request DELETE \
  --url https://blob.squarecloud.app/v1/objects \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "object": "<string>"
}
'
import requests

url = "https://blob.squarecloud.app/v1/objects"

payload = { "object": "<string>" }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}

response = requests.delete(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'DELETE',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({object: '<string>'})
};

fetch('https://blob.squarecloud.app/v1/objects', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://blob.squarecloud.app/v1/objects",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'object' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://blob.squarecloud.app/v1/objects"

payload := strings.NewReader("{\n \"object\": \"<string>\"\n}")

req, _ := http.NewRequest("DELETE", url, payload)

req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.delete("https://blob.squarecloud.app/v1/objects")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"object\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://blob.squarecloud.app/v1/objects")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"object\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success"
}
Authorization
string
obbligatorio
La chiave API del tuo account. Puoi trovarla nelle impostazioni del tuo account.
object
string
obbligatorio
Il nome dell’oggetto da eliminare. Il nome dell’oggetto deve rispettare il seguente pattern: a to z, A to Z, 0 to 9, and _.
{ "object": "ID/prefix/name1_ltq7b2sw-de6241.jpeg" }

Risposta

status
string
Indica se la chiamata ha avuto successo. “success” in caso di successo, “error” in caso contrario.
{
  "status": "success"
}

Risoluzione dei problemi

Relativi all’oggetto

// The request body is missing or is not a valid JSON object.
{
    "status": "error",
    "code": "INVALID_BODY"
}
// The provided object name is invalid.
{
    "status": "error",
    "code": "INVALID_OBJECT"
}
// The request to delete the objects failed. Please try again.
{
    "status": "error",
    "code": "FAILED_DELETE"
}