MMS Template

You can add, modify and delete MMS templates through the following interfaces. Please consult customer service for specific MMS price.


Add MMS template

URL

https://api.sendcloud.net/smsapi/addmms

HTTP Request Method

post

Parameter Description

parameter type required or not description
smsUser string smsUser
templateName string 模板名称,不能重复
templateText string 模板标题
signName string * 彩信内容中的中括号里面的签名
signId Integer * 短信签名的id
signPositionStr string 签名位置,"0"代表前置"1"代表后置,默认前置
smsTypeStr string 彩信内容类型,"1"表示行业通知,"2"表示营销,默认行业通知
mmsList string 彩信附件,用tms方式加密打包
signature string 数字签名, 合法性验证

附件 mmsList参数说明如下:

  1. 附件可以有1~3页;
  2. 每页文档、图片、音频至少有一个,最多各一个;
  3. 图片支持jpg、gif、png,音频支持mis、amr格式;
  4. Tms格式打包文件后,需要base64加密再传入参数mmsList。

tms打包方式示例

public static byte[] getTms(String file) throws IOException {
    File f = new File(file);
    if (f.exists()) {
        String fileName = f.getName();
        int fileSize = (int) f.length();
        try {
            byte[] fileBytes = new byte[fileSize];
            byte[] filenameBytes = (fileName + "\0").getBytes("UTF-8");
            FileInputStream stream = new FileInputStream(file);
            DataInputStream ds = new DataInputStream(stream);
            for (int i = 0; i < fileSize; i++) {
                fileBytes[i] = ds.readByte();
            }

            int length = fileBytes.length + filenameBytes.length + 4;
            ByteBuffer buffer = ByteBuffer.allocate(length);
            buffer.put((fileName + "\0").getBytes("UTF-8"));
            ByteBuffer bufferLength = ByteBuffer.allocate(4);
            bufferLength.order(ByteOrder.LITTLE_ENDIAN);
            bufferLength.putInt(fileSize);

            buffer.put(bufferLength.array());
            buffer.put(fileBytes);
            return buffer.array();
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        }
    }
    return null;
}

Returned value description

parameter Description
templateId 彩信模板ID

Returned value example

{
    "info" : {
        "templateId" : 3381
    },
    "message" : "插入成功",
    "result" : true,
    "statusCode" : 200
}

Modify MMS template

URL

https://api.sendcloud.net/smsapi/updatemms

HTTP Request Method

post

Parameter Description

parameter type required or not description
smsUser string smsUser
templateIdStr string 模板ID
templateName string 模板名称
templateText string 模板标题
signName string * 彩信内容中的中括号里面的签名
signId Integer * 彩信签名的id
signPositionStr string 签名位置: "0"代表前置, "1"代表后置
smsTypeStr string 彩信内容类型,"1"表示行业通知,"2"表示营销,默认行业通知
signature string 数字签名, 合法性验证

注意:

  1. signId为短信签名的id,signId和signName两个参数只需要传一个即可,如果signId不为空,signName自动忽略

Returned value example

{
    "result" : true,
    "statusCode" : 200,
    "message" : "更新成功",
    "info" : {}
}

Delete MMS template

URL

https://api.sendcloud.net/smsapi/deletemms

HTTP Request Method

post    get

Parameter Description

parameter type required or not description
smsUser string smsUser
templateIdStr string 模板ID
signature string 数字签名, 合法性验证

Request Example

https://api.sendcloud.net/smsapi/deletemms?smsUser=***&templateIdStr=***&signature=***

Returned value example

{
    "result" : true,
    "statusCode" : 200,
    "message" : "删除成功",
    "info" : {}
}