API Integration

POST loading...

Parameter Request

Kirimkan file Anda menggunakan metode POST dengan format multipart/form-data.

Parameter Tipe Wajib Keterangan
file Binary Ya File gambar, dokumen, atau video (Maks 200MB).

Contoh Implementasi

JavaScript

const formData = new FormData();
formData.append('file', fileInput.files[0]);

fetch('[BASE_URL]/cdn/api.php', {
    method: 'POST',
    body: formData
})
.then(res => res.json())
.then(data => console.log(data));

PHP (cURL)

$file = new CURLFile('image.jpg');
$ch = curl_init('[BASE_URL]/cdn/api.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file' => $file]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo $response;

Respon Server

200 OK - Success
{
  "status": "success",
  "url": "[BASE_URL]/f/custom123.jpg",
  "filename": "custom123.jpg",
  "originalName": "foto.jpg"
}
400 Error - Failed
{
  "status": "error",
  "message": "Upload limit exceeded (200MB max)"
}