https://api.laaffic.com/v3/mmsUpload
Parameters | Description | Required | Type |
---|---|---|---|
fileType | MMS attachment type, support:[png,jpg,jpeg,bmp,gif,webp,psd,svg,tiff,mp3,wav,txt,vcf] | Yes | String |
fileData | MMS file base64 encrypted transfer. The maximum size of an MMS attachment is 50kb, and a single task can carry up to 3 MMS files. (For base64 code conversion, please refer to the JAVA sample code at the very bottom of the program) | Yes | String |
Request URL:
https://api.laaffic.com/v3/mmsUpload
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"fileType":"txt",
"fileData":"MTizNDU2"
}
Request URL:
https://api.laaffic.com/v3/mmsUpload
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"fileType":"png",
"fileData":"Base64 encoded file content"
}
Parameters | Description | Type |
---|---|---|
status | "0"means successful, others than 0 means failure, seeing Status Code description. | String |
reason | Failure reason description | String |
data | Upload attachment id, valid for 3 days, can be used to send MMS repeatedly within 3 days | String |
{
"status":"0",
"reason":"success",
"data":"57_3_1727059993381.txt"
}
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;
}
Need help?
Click here and start chatting with us!