Endpoint: POST /upload
Parameter multipart/form-data:
elrayyxml: File yang akan diupload (required).duration: Durasi file sebelum dihapus (optional). Format: [value][unit].
m (menit), h (jam), d (hari), M (bulan).10m, 1h, 7d, 1M.const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
async function uploadFile(filePath) {
try {
const form = new FormData();
form.append('elrayyxml', fs.createReadStream(filePath));
form.append('duration', '10m'); // Optional
const response = await axios.post(
'https://s.elrayyxml.my.id/upload',
form,
{ headers: form.getHeaders() }
);
return response.data;
} catch (error) {
console.error('Upload Error:', error.message);
}
}
uploadFile('./path/to/your/file.jpg');
curl -X POST -F "elrayyxml=@mypic.jpg" -F "duration=10m" https://s.elrayyxml.my.id/upload
Endpoint: POST /shorten
Body application/json:
{
"url": "https://example.com"
}
const axios = require('axios');
async function shortenUrl(longUrl) {
try {
const response = await axios.post(
'http://s.elrayyxml.my.id/shorten',
{ url: longUrl },
{ headers: { 'Content-Type': 'application/json' } }
);
return response.data;
} catch (error) {
console.error('Shorten Error:', error.message);
}
}
shortenUrl('https://example.com');
curl -X POST -H "Content-Type: application/json" -d '{"url":"https://example.com"}' https://s.elrayyxml.my.id/shorten