HTTP API - Submitting multiple SMS over HTTP Post
To get better performance it is a good practice to send several messages with a single HTTP request. You can do this by adding the messagecount parameter to your request and by attaching a sequence number to the end of each HTTP api parameter that relates to the submitted messages.
Example URL Request for HTTP GEThttps://127.0.0.1:9508/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 Request for HTTP POST
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=https://127.0.0.1:9508/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:9509 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