Delete files
Delete files from your IM Cloud Storage
POST
https://api.imagemash.io/v1/storage/deleteFiles
Headers
Name
Type
Description
apikey*
Your API Key
Request Body
Name
Type
Description
filePaths*
Array
Array of filePaths. Eg. /jeep.png
or /cars/jeep.png
{
"deletedCount": 2,
"erroredCount": 0,
"deletedFiles": [
"/Asset 1.png",
"/Asset 2.png"
],
"erroredFiles": []
}
{
msg: "error details"
details: "..."
} // Explanation of error
Unauthorized
{
// Please contact support if you are getting this error constantly.
}
Example Codes
curl --location 'https://api.imagemash.io/v1/storage/deleteFiles' \
--header 'apikey: your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"filePaths":[
"/Asset 1.png",
"/Asset 2.png"
]
}'
using System;
using RestSharp;
using System.Threading;
using System.Threading.Tasks;
namespace HelloWorldApplication {
class HelloWorld {
static async Task Main(string[] args) {
var options = new RestClientOptions("https://api.imagemash.io")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/v1/storage/deleteFiles", Method.Post);
request.AddHeader("apikey", "your_api_key");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("filePaths", "/Asset 1.png");
request.AddParameter("filePaths", "/Asset 2.png");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
}
}
}
import java.io.*;
import okhttp3.*;
public class main {
public static void main(String []args) throws IOException{
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "filePaths=/Asset 1.png&filePaths=/Asset 2.png");
Request request = new Request.Builder()
.url("https://api.imagemash.io/v1/storage/deleteFiles")
.method("POST", body)
.addHeader("apikey", "your_api_key")
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
var axios = require('axios');
var data = JSON.stringify({
"filePaths": [
"/Asset 1.png",
"/Asset 2.png"
]
});
var config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.imagemash.io/v1/storage/deleteFiles',
headers: {
'apikey': 'your_api_key',
'Content-Type': 'application/json'
},
maxRedirects: 0,
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import requests
url = "https://api.imagemash.io/v1/storage/deleteFiles"
payload='filePaths=%2FAsset%201.png&filePaths=%2FAsset%202.png'
headers = {
'apikey': 'your_api_key',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://api.imagemash.io/v1/storage/deleteFiles")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = "your_api_key"
request["Content-Type"] = "application/x-www-form-urlencoded"
request.body = "filePaths=%2FAsset%201.png&filePaths=%2FAsset%202.png"
response = https.request(request)
puts response.read_body
Last updated