Ozeki NG SMS Gateway

How to send multiple SMS using HTTP Post

To send multiple SMS in one batch, you can use the sendmessages method in a HTTP post request. The secret to posting multiple messages is to use the messagecount parameter. When submitting a batch of sms, messages each sms can have it's own unique destination number, and it's own unique messages text. A single http post can carry up to 20000 SMS messages.

How to send multiple SMS using HTTP (simple steps)

To send multiple SMS using HTTP
  1. Compose the URL prefix (http://127.0.0.1:9501/api)
  2. Use HTTP POST
  3. Use application/x-www-form-urlencoded as content type
  4. Append the sendmessage action to send texts
  5. Add the messagecount parameter
  6. Specify your username and password
  7. To send multiple sms append recipient fields
  8. To send unique texts append messagedata fields
  9. Submit the HTTP Post request
  10. Check the sent text messages on the mobiles

The benefits of sending a batch of SMS with a single HTTP request

If you submit multiple SMS using a single HTTP post request, you get better performance because you limit the HTTP overhead. Another benefit to using a smaller number of http requests is that you save on SMS gateway server resources. Parsing 10000 HTTP requests on the SMS gateway side consumes significantly more CPU, memory and network resources, then parsing a single HTTP request with 10000 SMS. We can state that it is a good practice to send several messages with a single HTTP request for high capacity systems.

Submitting multiple sms over http post

To submit multiple sms over http, all you have to do is to add the messagecount parameter to your request and to attach a sequence number to the end of each HTTP api parameter that relates to the submitted messages. You can specify a unique recipient phone number and a unique messages text for each sms.

Example HTTP GET request for submitting multiple sms

http://127.0.0.1:9501/api?action=sendmessage&messagecount=2&username=admin&password=abc123& recipient0=06203105366&messagetype0=SMS:TEXT&messagedata0=Hello+World& recipient1=06202222222&messagetype1=SMS:TEXT&messagedata1=Second+Message

Example HTTP POST request for submitting multiple sms

If you have a large number of messages, you should use HTTP Post to submit your request. You can do this by using the following HTML form:

 
<form action=http://127.0.0.1:9501/api method=post><br>
action: <input type=text name=action value=sendmessage><br>
messagecount: <input type=text name=messagecount value=2><br>
username: <input type=text name=username value=admin><br>
password: <input type=text name=password value=abc123><br>
recipient0: <input type=text name=recipient0 value=06203105366><br>
messagetype0: <input type=text name=messagetype0 value=SMS:TEXT><br>
messagedata0: <input type=text name=messagedata0 value='Hello World'><br>
recipient1: <input type=text name=recipient1 value=06202222222><br>
messagetype1: <input type=text name=messagetype1 value=SMS:TEXT><br>
messagedata1: <input type=text name=messagedata1 value='Second Message'><br>
<input type=submit value=OK>
</form>

This will produce the following HTTP POST request:

 
POST /api HTTP/1.1
Host: 127.0.0.1:9501
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 211

action=sendmessage&messagecount=2&username=admin&password=abc123&recipient0=06203105366&
messagetype0=SMS%3ATEXT&messagedata0=Hello+World&recipient1=06202222222&messagetype1=SMS%3ATEXT&
messagedata1=Second+Message

The response for this request will be:

 
<?xml version="1.0" encoding="utf-8"?>

<response>
  <action>sendmessage</action>
  <data>
    <acceptreport0>
      <statuscode0>0</statuscode0>
      <statusmessage0>Message accepted for delivery</statusmessage0>
      <messageid0>c4ce4d5e-b2d1-4399-bd2e-83dff97dfb19</messageid0>

      <originator0>+44777888</originator0>
      <recipient>06203105366</recipient>
      <messagetype0>SMS:TEXT</messagetype0>
      <messagedata0>Hello World</messagedata0>
      <serviceprovider0 />
    </acceptreport0>
    <acceptreport1>

      <statuscode1>0</statuscode1>
      <statusmessage1>Message accepted for delivery</statusmessage1>
      <messageid1>5ebae14b-8b58-4d99-979b-71e0bbd66132</messageid1>
      <originator1>+44777888</originator1>
      <recipient>06202222222</recipient>
      <messagetype1>SMS:TEXT</messagetype1>

      <messagedata1>Second Message</messagedata1>
      <serviceprovider1 />
    </acceptreport1>
  </data>
</response>

More information