首頁 > API中心 > IVR群呼 > 文檔指引
| 參數 | 說明 | 是否必填 | 類型 |
|---|---|---|---|
| fileName | 帶尾碼的檔案名,5-32字元 | 是 | String |
| file | base64編碼的檔內容(base64編碼轉換可查看該方法最下方JAVA示例代碼),檔大小1Mb,只支持MP3、WAV | 是 | String |
Request URL:
https://api.laaffic.com/v3/cc/seatGroup/upload
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"fileName":"test.mp3",
"file":"base64編碼的檔內容"
}| 參數 | 說明 | 類型 |
|---|---|---|
| status | 狀態碼,0成功,其他失敗參見響應狀態碼說明 | String |
| reason | 失敗原因說明 | String |
| data | Object | |
| fileName | 檔案名 | String |
| fileUrl | 檔路徑 | String |
{
"status": "0",
"reason": "success",
"data": {
"fileName": "turnseatring-template/120250106d88d71eb084746fcb7c77a4922d82ed1.mp3",
"fileUrl":"http://xxx"
}
}
| status | 狀態說明 |
|---|---|
| 0 | 成功 |
| -1 | 帳號認證異常 |
| -2 | ip限制 |
| -16 | 時間戳過期 |
| -18 | 系統異常 |
| -20 | 數據已存在 |
| -21 | 數據校驗異常 |
| -22 | 參數異常 |
| -27 | 您上傳的檔格式不正確。請重新上傳!(如有任何疑問,請聯繫客服。) |
| -38 | 檔過大 |
| -39 | 上傳檔格式有誤 |
package com;
import cn.hutool.core.codec.Base64;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class Test {
public static void main(String[] args) {
File f = new File("c:\tmp\test.mp3");
System.out.println(file2Base64(f));
}
public static String file2Base64(File file) {
if(file==null) {
return null;
}
String base64 = null;
FileInputStream fin = null;
try {
fin = new FileInputStream(file);
byte[] buff = new byte[fin.available()];
fin.read(buff);
base64 = Base64.encode(buff);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fin != null) {
try {
fin.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return base64;
}
}
對接有疑問?聯絡我們的技術支援
LAAFFIC API 專屬 TG 技術對接頻道,即時回應您的需求
點擊此處開啟人工服務