If you are working on telephone solutions, please check
out the Ozeki VoIP SIP SDK.
It can be used to create VoIP client and server software. |
|
HTTP SMS API - sendmessage method
(available in version:
Ozeki NG SMS Gateway v3.0.1 or newer)
This method can be used to send an SMS message via the SMS Gateway. The method
can be used to send text SMS messages or other
message types, such as binary SMS messages, operator logos, ringtones, WAP PUSH,
etc... A complete
list of available message types can be found in the
Mobile Message Type Specification.
When you use this method, you must specify the recipient phone number, the
message type and the message data.
Example URL Request
http://127.0.0.1:9501/api?action=sendmessage&username=admin&password=abc123&
recipient=06203105366&messagetype=SMS:TEXT&messagedata=Hello+World
Example Response
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 246
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE smsapi PUBLIC "-//OZEKI//DTD XML 1.0//EN" "http://www.ozekisms.com/DTD/smsapi.xml">
<response>
<action>sendmessage</action>
<data>
<acceptreport>
<statuscode>0</statuscode>
<statusmessage>Message accepted for delivery</statusmessage>
<messageid>ERFAV23D</messageid>
<recipient>06203105366</recipient>
</acceptreport>
</data>
</response>
Description
To send a text message via SMS, use the following URL format:
http://127.0.0.1:9501/api?action=sendmessage&username=UUUUU&password=PPPPP&
recipient=NNNNN&messagetype=MMMMM&messagedata=DDDDD
For 127.0.0.1, please substitute the IP address or host name of the computer
your Ozeki NG SMS gateway is installed on. (Note: 127.0.0.1 is a local
loopback address that can be used when you are connecting to the SMS software
from the same computer.) The number 9501 is the default port of the SMS
gateway. In most environments it should not be changed.
"UUUUU" and "PPPPP" should be replaced to the username and password of the
user you
have created in the SMS gateway. If you have not created any user, you can
use admin as the username and abc123 as the password to use the default account.
Substitute the phone number that you wish to send the SMS message to
for the "NNNNN". You can use local phone number format, or international phone
number format (telephone numbers formatted according to the international number
format start with a plus sign). If the international phone number format is used,
note that you must substitute “%2B” for the “+” character, because of URL
encoding rules.
The message type should be substituted for "MMMMM". For text messages you
will use the "SMS:TEXT" message type.
The message data should be substituted for "DDDDD". The message data should be
using UTF-8 characters and should be
urlencoded.
Other parameters can also be added to the request. For a complete list of
available parameters please take a look at the "Request parameters" table.
Request parameters
Parameter |
Description |
Possible values |
Example |
M/O* |
action |
Specifies the HTTP API command |
sendmessage |
action=sendmessage |
M |
username |
Specifies the username.
The username and password parameters are used to
authenticate the user. When you send an message it will
be sent in the name of the authenticated user. The value
must be urlencoced.
|
string value, maximum length is 16 characters
|
username=admin |
M |
password |
Specifies the password.
The username and password parameters are used to
authenticate the user. When you send an message it will
be sent in the name of the authenticated user.
The value
must be urlencoced.
|
string value, maximum length is 16 characters
|
password=abc123 |
M |
originator |
Specifies the sender address. This information will be displayed
on the mobile phone, that receives the message. This is the sender
address. This can be a telephone number, a short code or an alphanumeric
sender address. The telephone number must can be formatted in local
number format (e.g.06201234567) or in international number format
(e.g.+36201234567).
If you use an alphanumeric sender address (e.g.ozeki), the characters
must be encoded in UTF8 and the value must be
urlencoded.
|
string value, maximum length is 16 characters
|
originator=%2B36201112222 |
O |
recipient |
Specifies the recipient phone number.
The message will be sent to this telephone number. The telephone number
can be specified in local number format (e.g.06201234567), or in
international number format (e.g.+36201234567).
More then one recipient addresses can be separated by a colon (e.g.:
+36201234567,+36202222222)
The value must be urlencoded.
|
string value, maximum length is 16 characters
|
recipient=%2B36201234567 |
M |
messagetype |
Specifies the message type.
The type of the SMS message data based on the
Mobile Message Type Specification.
For text messages the message data will be plain text, for other message
types it will be an XML document.
|
SMS:TEXT
SMS:WAPPUSH
...
Possible values can be found in
the Mobil Message Type Specification
|
messagetype=SMS:TEXT |
O |
messagedata |
Specifies the text or the data of the SMS message.
The value must be encoded in UTF8 and must be urlencoded.
|
string value, maximum length is 32768 characters
|
messagedata=Hello+World |
M |
_charset_ |
Specifies the charset of the encoded data (if not specified utf-8
will be assumed).
Newer browsers should set the value of _charset_ automatically. If your
browser doesn't support this feature you can set is manually to:
|
utf-8
windows-1250
iso-8859-1
iso-8859-2
...
(Supported character set values)
|
_charset_=iso-8859-2 |
O |
serviceprovider |
Specifies the name of the GSM Modem or IP SMS service provider
connection to use to send the message.
More information about service provider connection selection is
available in
the HTTP SMS API - SMS routing
guide.
The value must match the string specified on the configuration
form of the service provider connection.
|
string value, maximum length is 16 characters
|
serviceprovider=Vodafone |
O |
sendondate |
Specifies the date and time, when the message should be sent.
The value must use the following date format: YYYY-MM-DD hh:mm:ss. The
value must be url encoded
|
date value in YYYY-MM-DD hh:mm:ss format
|
sendondate=2009-12-12%2010:00:00 |
O |
responseformat |
After the gateway submits the SMS message, the gateway will return a
web page indicating that the message was submitted successfully. The
content
of the webpage is formatted according to the responseformat
parameter. You can have html text response to make it easy for humans
to read it or you can have xml format to make it easy for software to
process the response.
|
xml (default)
html
urlencoded
|
responseformat=xml
|
O |
continueurl |
After the gateway submits the SMS message, the gateway will return a
web page indicating that the message was submitted successfully. The
content
of the webpage is formatted according to the responseformat
parameter. If the responseformat parameter is set to html, the webpage
can contain a "Continue" link. If you specify the URL in this parameter
the continue link will be displayed and it will point to the specified
URL. The value of the URL must be urlencoded.
The URL you specify can contain keywords that will be replaced to state
information corresponding to the submitted message. More information about
possible keywords can be found in the
"Submit URL keywords" guide.
|
string value, maximum length is 1024 characters
|
continueurl=www.ozekisms.com
or
continueurl=http%3A%2F%2Fwww.ozekisms. com%2Findex.php%3Fowpn%3D159
Note: the second example contains an
urlencoded URL.
|
O |
redirecturl |
After the gateway submits the SMS message, by default the gateway
will return a web page indicating that the message was submitted
successfully. Optionally you can ask the gateway to automatically
redirect the browser to an URL you specify. If you specify an URL in
the redirect parameter, the HTTP response returned
by the SMS gateway will contain a redirect URL in the HTTP header. This
will instruct the webbrowser to follow the link you have specified. The
value of the URL must be
urlencoded.
The URL you specify can contain keywords that will be replaced to state
information corresponding to the submitted message. More information
about possible keywords can be found in the
"Submit URL keywords" guide.
|
string value, maximum length is 1024 characters
|
redirecturl=www.ozekisms.com
or
redirecturl=http%3A%2F%2Fwww.ozekisms. com%2Findex.php%3Fowpn%3D159
Note: the second example contains an urlencoded URL.
|
O |
reporturl |
You can setup a webpage to process information about "delivered
to network" and "delivered to handset" events. If you
specify an URL in the reporturl parameter, your webpage will be
called when these events happen. The value of the URL you specify in
the reporturl parameter must be
urlencoded.
The URL you specify can contain keywords that will be replaced to state
information corresponding to the submitted message. More information
about possible keywords can be found in the
"Submit URL keywords" guide.
Please also note, that if you want the reporturl parameter to work,
you must create a "HTTP server user" account and use it's username and
password. The "Standard user" account does not support this option.
|
string value, maximum length is 1024 characters
|
reporturl=http%3A%2F%2Fwww.ozekisms. com%2Fproc.php%3Freporttype%3D%24reporttype
%26messageid%3D%24messageid
Note: this is the urlencoded version of the following URL.
Before this
URL is called by the SMS gateway, the $reporttype and $messageid
parameters will be replaced to the
appropriate values:
http://www.ozekisms.com/proc.php?reporttype=$reporttype& messageid=$messageid
will be called as:
http://www.ozekisms.com/proc.php?reporttype=deliveredtonetwork& messageid=ERFAV23D
|
O |
maxresponse |
This number specifies the maximum of messages about which you
will receive a feedback. If you exceed this number, your messages will
be sent out but you won't receive feedback about them. By default,
this parameter is set to 500 messages.
|
number |
maxresponse=1000 |
O |
* M = Mandatory parameter, O = Optional parameter
Response parameters
(xml response format)
Parameter |
Description |
Possible values |
Example |
acceptreport |
Contains the response for the submit request for a single recipient
address. If many recipients were specified, an acceptreport will be
included in the response for
each recipient. The order of acceptreports will match the order of the
recipient
addresses.
|
|
<acceptreport>
<statuscode>0</statuscode>
<statusmessage>Message accepted
for delivery</statusmessage>
<messageid>ERFAV23D</messageid>
<recipient>06203105366</recipient>
</acceptreport> |
acceptreport.statuscode |
Contains an integer value to indicate success or failure. If
the value is 0, it means the message was accepted for delivery. If
the value is greater then 0 it means there was an error, the message
was not accepted for delivery.
|
Integer value, greater then or equal to 0. Less the 32768. |
<statuscode>0</statuscode>
|
acceptreport.statusmessage |
Contains a textual representation of the status code. If
the message was accepted the value will be "Message accepted for
delivery". If
the message was not accepted for delivery, you can find the error message
in this field.
|
string value, maximum length is 1024 characters |
<statusmessage>Message accepted for delivery</statusmessage>
|
acceptreport.messageid |
Contains a message reference that can be used to track the
message in the SMS gateway. This message reference is also used
to identify delivered to network and delivered to handset reports or
to query information about the message.
|
string value, maximum length is 16 characters |
<messageid>ERFAV23D</messageid>
|
acceptreport.recipient |
Contains the recipient address.
|
string value, maximum length is 16 characters |
<recipient>06203105366</recipient>
|
Next page:
URL template
|