Smsplace Bulksms HTTP API
Smsplace Bulksms HTTP API
Document Information
Modification Version
Change Summary Author
Date Number
Restructured and reformatted document.
Replaced mobile phone no. in „Destination‟
January 24, 1.0.1 field with „xxxxxxx‟. Hrudeep
2018 Added error codes under section „HTTP API to Goregaonkar
Submit Messages on SMPP’.
All parameters are explained below. Note that all the parameters, especially message
and URL should be URL-UTF-8 encoded.
Request Parameters
Sr. No. Parameter Description
1 username The username of the HTTP account.
2 password The password of the HTTP account.
It indicates the type of message. Values for type include:
0: Plain text (GSM 3.38 Character encoding)
1: Flash (GSM 3.38 Character encoding)
2: Unicode
3 type 3: Reserved
4: WAP Push
5: Plain text (ISO-8859-1 Character encoding)
6: Unicode Flash
7: Flash (ISO-8859-1 Character encoding)
Indicates whether the client wants delivery report for this message.
The values for dlr include:
4 dlr
0: No delivery report required
1: Delivery report required
Mobile number to which the message is to be sent (may or may not
5 destination include a plus [+] sign). Multiple mobile numbers can be separated by
commas (,) (the comma should be URL encoded).
The source address that should appear in the message.
Max Length of 18 if numeric.
Max Length of 11 if alphanumeric.
To prefix the plus sign (+) to the sender‟s address when the
6 source message is displayed on their cell phone, please prefix the plus sign
to your sender‟s address while submitting the message (note the
plus sign should be URL encoded). Additional restrictions on this
field may be enforced by the SMSC.
The message to be sent. It can be used for 'long' messages, that is,
7 message messages longer than 160 characters for plain text, 140 for flash
and 280 for Unicode. For concatenated (long) messages every 153
Error Codes
Error codes are explained in the following table.
Response
Sr. No. Error Code Description
Success, Message Submitted Successfully. In this case you will receive
1 1701the response 1701|<CELL_NO>|<MESSAGE ID>. The message Id can then
be used later to map the delivery reports to this message.
1702 Invalid URL. This means that one of the parameters was not provided
or left blank.
Exceptional Situations
A request containing multiple destinations will be aborted immediately if any error other
than “Invalid Destination” is found. In case an invalid destination is found we just skip
that destination and proceed to the next destination.
If, while processing the request, the SMPP server goes down, the HTTP API will retry a
fixed number (with a gap of ten milliseconds between consecutive retries) of times to
reconnect to the SMPP server and submit the message. In case the SMPP server does
not come up before the fixed number of attempts are exhausted, the batch will
be aborted at that destination and a message will be returned in following format:
<Error_Code>|<destination>|<message_id>,<Error_Code>|<destination>|<message_id>,170
9| <destination_at_which_batch_aborted>
The credits can get exhausted in the middle of a request being serviced. In case such
a situation occurs we will be aborting the batch on the destination at which we got the
“Insufficient_Credit” error, and a response in the following format will be returned to
the client:
<Error_Code>|<destination>|<message_id>,<Error_Code>|<destination>|<message_id>,102
5| <destination_at_which_batch_aborted>
Example link to submit plain text messages (GSM 03.38 character set)
http:// rslr.connectbind.com:8080/bulksms/bulksms?
username=XXXX&password=YYYYY&type=0&dlr=1&destination=
%2Bxxxxxxx&source=xxxxxxx&message=Demo%20Message!!!
On calling the above link by replacing the username and password by your account
credentials, the message „Demo Message!!!‟ should display on your cell phone.
The characters in the message field should fall in the GSM 03.38 character set and the
type parameter has to be set to 1 i. e. (type=1).
On calling the above link by replacing the username and password by your account
credentials, the sms „Demo Message!!!‟ should flash on the mobile number in the
destination field.
The message has to be encoded in the UTF-16BE format and the type parameter has to be
set to 6 i.e. (type=6).
Example link to submit Unicode messages
http:// rslr.connectbind.com:8080/bulksms/bulksms?
username=XXXX&password=YYYYY&type=2&dlr=0&destination=xxxxxxx&source=xxxxxxxx&message=00
440065006D006F0020004D006500730073006100670065 002100210021
On calling the above link by replacing the username and password by your account credentials, you
should get the SMS „Demo Message!!!‟ on the mobile number in the destination field.
The message has to be encoded on the UTF-16BE format and the type parameter has to
be set to 6 i.e. (type=2).
ArrayOFBytes(v) = ArrayOFBytes(v + 1)
ArrayOFBytes(v + 1) = t
End If
Next
For v = 0 To ArrayOFBytes.Length - 1 Dim
c As String = Hex$(ArrayOFBytes(v)) If
c.Length = 1 Then
c = "0" & c
End If
UnicodeString = UnicodeString & c
Next
Return UnicodeString
End Function
End Class
$hex='';
$live_url="http://".$this->host.":".$this-
>port."/bulksms/bulksms?username=".$this->strUserName."&password=".$this-
>strPassword."&type=".$this >strMessageType."&dlr=".$this-
>strDlr."&destination=".$this->strMobile."&source=".$this-
>strSender."&message=".$this-
>strMessage.""; $parse_url=file($live_url);
echo $parse_url[0];
}catch(Exception $e){
echo 'Message:' .$e->getMessage();
}
} else
$this>strMessage=urlencode($this->strMessage);
try{
// http Url to send sms.
$live_url="http://".$this->host.":".
$this->port."/bulksms/bulksms?username=".$this-
>strUserName."&password=".$this->strPassword."&type=".$this-
>strMessageType."&dlr=".$this->strDlr."&destination=".$this-
>strMobile."&source=".$this-
>strSender."&message=".$this-
>strMessage."";
$parse_url=file($live_url);
echo $parse_url[0];
try {
// Url that will be called to submit the message
URL sendUrl = new URL("http://" + this.server +
+ "/bulksms/bulksms");
HttpURLConnection httpConnection =
(HttpURLConnection) sendUrl .openConnection();
":" + this.port
// This method sets the method type to POST so
that
// will be send as a POST request
httpConnection.setRequestMethod("POST")
;
// This method is set as true which we intend to send
// input to the server
httpConnection.setDoInput(true);
// This method implies that we intend to receive data from server.
httpConnection.setDoOutput(true);
// Implies do not use cached data
httpConnection.setUseCaches(false);
// Data that will be sent over the stream to the server.
DataOutputStream dataStreamToServer = new
DataOutputStream( httpConnection.getOutputStream());
s.submitMessage();
// Below example is for sending unicode
Sender s1 = new Sender("smpp2.xxxxxxxx.com", 8080, "xxxx",
"xxx", CONVERTTOUNICODE("test for unicode").toString(), "1",
"2", "xxxxxxx", "Update"); s1.submitMessage();
/**
* Below method converts the unicode to hex value
* @param regText
* @return