上傳坐席組呼入響鈴
POST
https://api.laaffic.com/v3/cc/seatGroup/upload
上傳坐席組呼入響鈴。
請求示例
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",
"reason": "success",
"data": {
"fileName": "turnseatring-template/120250106d88d71eb084746fcb7c77a4922d82ed1.mp3",
"fileUrl":"http://xxx"
}
}
響應狀態碼
status |
狀態說明 |
0 |
成功 |
-1 |
帳號認證異常 |
-2 |
ip限制 |
-16 |
時間戳過期 |
-18 |
系統異常 |
-20 |
數據已存在 |
-21 |
數據校驗異常 |
-22 |
參數異常 |
-27 |
您上傳的檔格式不正確。請重新上傳!(如有任何疑問,請聯繫客服。) |
-38 |
檔過大 |
-39 |
上傳檔格式有誤 |
Java-base64編碼轉換示例代碼:
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;
}
}