무거운 파일, 일괄 처리, 장시간 실행되는 오디오 또는 동영상 작업, 또는 작업이 진행되는 동안 업로드 요청을 열어 둔 채로 두지 않아야 하는 운영용 애플리케이션에는 비동기 변환을 사용하세요.
| 양식 필드 | 유형 | 설명 |
target_format | 문자열 | 원하는 출력 형식입니다. 소스와 대상이 변환 쌍을 이룹니다. 예: mp42mp3. |
files | file[] | 변환할 파일 1개 이상. |
cURL
curl -X POST "https://api.converter.app/convert" \
-H "X-API-Key: YOUR_API_KEY" \
-F "target_format=mp3" \
-F "files=@/path/to/video.mp4"
JavaScript
const form = new FormData();
form.append('target_format', 'mp3');
form.append('files', fileInput.files[0]);
const response = await fetch('https://api.converter.app/convert', {
method: 'POST',
headers: {
'X-API-Key': apiKey
},
body: form
});
const job = await response.json();
console.log(job.jobid, job.remaining_quota);
Python
import requests
headers = {'X-API-Key': 'YOUR_API_KEY'}
data = {'target_format': 'mp3'}
with open('/path/to/video.mp4', 'rb') as video:
files = {'files': video}
response = requests.post(
'https://api.converter.app/convert',
headers=headers,
data=data,
files=files
)
response.raise_for_status()
job = response.json()
print(job['jobid'], job['remaining_quota'])
성공 응답
{
"status": "success",
"jobid": "b3f6b2e8f5c34c4ab01c93c4d1b2f9e8",
"pair": "mp42mp3",
"remaining_quota": 42
}