Home > API Center > API interface guide

 
 

mmsUpload

POST
https://api.itniotech.com/sms/mmsUpload
Upload Attachment
 
Request Parameters
Parameter Description Required Type
fileType MMS attachment type. Supported types: [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 (see the Java example code at the bottom of this page for Base64 conversion). Yes String
 
Request Example
Request URL:
    https://api.itniotech.com/sms/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":"MTizNDU2"
}
 
Request Example for Uploading a PNG Attachment:
Request URL:
    https://api.itniotech.com/sms/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"
}
 
Response Parameters
Parameter Description Type
status Status code: 0 indicates success. For other values, see the Response Status Codes documentation. String
reason Description of the failure reason String
data Uploaded attachment ID. Valid for 3 days and can be reused for sending within that period. String
 
Response Example
{
    "status":"0",
    "reason":"success",
    "data":"57_3_1727059993381.txt"
}
 
Java Base64 Encoding Conversion Example:
 
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;
}