HTTPS API v2 / Sending MMS messages
Principles of operation
To send an MMS message, you must first load the multimedia file using the option of uploading files. Only after uploading the necessary files (eg pictures, sound or video), it is possible to send an MMS message where the subscriber specifies the identifier of the file to be sent.
Uploading a file
Saving the file on the server consists in sending the URL of the file along with the appropriate parameters. The system will check if the file exists and if it meets the requirements and if the verification is successful, the data will be saved on the server and the subscriber will receive a JSON / XML document containing the file identifier. The file is sent in the following way:
files/add
Available parameters
Parameter | Type | An example value or format | Description |
username | String | login | Username used to dispatch the message |
password | String | password |
Password to the account |
type | String | mms or voice | Type file. |
url | String | eg.: http://www.serwer.pl/kat/plik.jpg | URL file. |
file | String | file | Upload the file from the disk. The "url" must remain empty. Only for MMS files. |
As a result, a JSON document will be generated, e.g. as follows:
{
"success": true,
"id": "b67d70c22d"
}
It is possible to upload certain file types:
Content-Type | file extension |
---|---|
image/gif | gif |
image/jpeg | jpeg |
image/jpg | jpg |
image/png | png |
text/plain | txt |
Listing files
To list files downloaded to the server and retrieve their identifiers, which can then be used in MMS sending, call the action:
files/index
As a result, a JSON document will be generated, e.g. as follows:
{
"items":[{
"id":"b67d70c22d",
"name":"plik1.jpg",
"size":174562,
"type":"mms",
"date":"2014-10-07 16:54:53"
},
{
"id":"39b0d42508",
"name":"plik2.jpg",
"size":344241,
"type":"mms",
"date":"2014-10-07 16:54:53"
},
{
"id":"aad84d6e71",
"name":"plik3.txt",
"size":27,
"type":"mms",
"date":"2014-10-07 16:50:10"
}]
}
Sending MMS
For using the remote operation to send an MMS message, call the specified URL using the POST method.
messages/send_mms
Available parameters
Parameter | Type | An example value or format | Description |
---|---|---|---|
username | String | login | Username used to dispatch the message |
password | String | password |
Password to the account |
title | String | Title MMS | Title MMS. Available is 40 characters. |
file_id | String|Array | ID file |
ID file can be downloaded by first upload and listing of available files for MMS. You can also send up to 10 files where their IDs will be sent using an array. |
phone | String|Array | +48500600700 | The number or telephone numbers provided in the table. |
details | Boolean | true, false or none |
The parameter displays in response to feedback details sent messages. |
text | String | Contents | The content of MMS. It will be automatically saved to a file and attached to the message. |
date | DateTime | ISO eg: „2010-11-09 15:23” |
An optional parameter allows you to specify the date of dispatch of SMS messages. |
test | Boolean | true, false or none | An optional parameter, allowing you to check the question sending an SMS message. In response document is generated JSON / XML identical to the standard question, but the message is not sent. |
The parameters in bold are obligatory. Others are optional.
Return generated after the message is the same as the regular sending of SMS messages.
{
"success":true,
"queued":2,
"unsent":2,
"items":[{
"id":"32039da8e9",
"phone":"+48500600700",
"status":"queued",
"queued":"2014-10-20 12:32:52",
"parts":1,
"text":"Title MMS"
},
{
"id":"844c2b4af0",
"phone":"+48500600500",
"status":"queued",
"queued":"2014-10-20 12:32:52",
"parts":1,
"text":"Title MMS"
},
{
"id":"6e373d7856",
"phone":"45616",
"status":"unsent",
"queued":"2014-10-20 12:32:52",
"error_code":3103,
"error_message":"Incorrect number",
"text":"Title MMS"
},
{
"id":"bf069fe2c1",
"phone":"7799123",
"status":"unsent",
"queued":"2014-10-20 12:32:52",
"error_code":3103,
"error_message":"Incorrect number",
"text":"Title MMS"
}]
}
Recommended settings
In the case of medium and large amounts of messages sent several thousand or more, it is recommended to transfer messages in "packages" after about 50-200 numbers in a single query. This will speed up considerably the process of transferring the data to SerwerSMS.pl and reduce the amount necessary to send queries.
If you send the same attachment, it is optimal to his one-time upload and then use his identifier for subsequent dispatch messages.