Home > API Center > API interface guide
https://api.laaffic.com/v3/mmsUpload
| Parameters | Description | Required | Type |
|---|---|---|---|
| fileType | Attachment type, support:[png,jpg,jpeg,bmp,gif,webp,psd,svg,tiff,mp3,wav,txt,vcf] | Yes | String |
| fileData | The file is transmitted using Base64 encoding. MMS attachments support up to 50 KB, and RCS attachments support up to 300 KB. (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;
}Questions about integration? Contact our technical support
LAAFFIC API dedicated TG technical support channel, real-time response to your needs