Ask for a format
Records the file extension of a format we don't support yet. Only the extension is kept, without the account or the address.
POST
https://api.switchfile.io/v1/app/format-requestsExample
Request
curl "https://api.switchfile.io/v1/app/format-requests" \
-H "Content-Type: application/json" \
-d '{
"extension": "heic"
}'const res = await fetch("https://api.switchfile.io/v1/app/format-requests", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
extension: "heic"
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());<?php
$ch = curl_init('https://api.switchfile.io/v1/app/format-requests');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'extension' => 'heic',
]),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $response");
}
print_r(json_decode($response, true));import requests
res = requests.post(
"https://api.switchfile.io/v1/app/format-requests",
json={
"extension": "heic",
},
)
res.raise_for_status()
print(res.json())Request body
extensionstringrequiredFile extension of the missing format, like heic
1 to 20 characters
Responses
202Recorded
extensionstringrequiredExtension as recorded: lower case, without the dot
202 application/json{ "extension": "heic" }422Invalid data. errors names the fields
INVALID_DATA422 application/problem+json{ "type": "https://switchfile.io/docs/api/v1#errors-invalid-data", "title": "Invalid data", "status": 422, "code": "INVALID_DATA", "detail": "The request contains invalid data.", "errors": { "to": [ "Expected string" ] } }429Too many requests or a daily quota is used up. See Retry-After
RATE_LIMIT_EXCEEDED429 application/problem+json{ "type": "https://switchfile.io/docs/api/v1#errors-rate-limit-exceeded", "title": "Rate limit exceeded", "status": 429, "code": "RATE_LIMIT_EXCEEDED", "detail": "Too many requests. Try again in 12 seconds." }