API Document Version 1.1.2
API Document Version 1.1.2
Welcome to Digimiles Developers hub. With this API documentation guide, we will be
assisting you here to configure, access and use of Digimiles SMS API into your
CRM/app/software.
http://www.loginurl.com/bulksms/bulksms?username=di78-
XXXX&password=XXXX&type=0&dlr=1&destination=99160XXXXX&source=DigiML&message
=Your OTP is {#var#}&entityid=XXXXXXXXXXXX&tempid=XXXXXXXXXXXXXXX
Parameters:
1. Username: Username of your SMS
Example: - di78-trans
2: Unicode
3: Reserved
4. dlr:
7. Entity ID – 19 digit entity ID of your Principal Entity (P.E). It can be accessed from your DLT
account
8. Temp ID – 19 digit template ID and it can be accessed from your DLT account.
Error Codes:
1701: Success, Message Submitted successfully, in this case you will receive
the response 1701|<CELL_NO>|<MESSAGE ID>, the message Id can Then
be used later to map the delivery reports to this message.
According to the standard GSM 03.38-character set, one can send up to 1000 characters as
multi-part text which will be split into 7 text messages according to the receiver’s device.
More than 1000 characters text message will split into more text message.
Unicode messaging, such as Hindi, Telugu, Kannada, Marathi, Malayalam, Tamil etc,
restricts your text to 70 characters per SMS.
http://www.loginurl.com/bulksms/bulksms?username=di78-
XYZ&password=mile&type=2&dlr=1&destination=99160XXXXX&source=DIGIML&message=Test
On calling the above link by replacing the username, password, mobile number and source, you
should get the Unicode SMS.
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).
#4. Credit Check API & Response
This section helps you to view the account’s credit balance by using credit check api.
GET
http://www.loginurl.com/CreditCheck/checkcredits?username=X&password=Y
POST
The DLR push API sends the delivery report to the client’s URL/ server address.
Above URL is the server address with folder name where SMS reports to be retrieved.
The parameters appended to the URL would be static. The parameters are explained below:
1. Schedule SMS
#6. Schedule SMS HTTP API
The below URL is an example of the Specifications
API used to schedule bulk messages.
http://<ipaddress>:<port>/bulksms/schedulesms?username=XXXXX&password=XXXXX&messag
e=XXXXXX&type=X&dlr=X&source=XXXXX&destination=XXXXXXXXXX&date=XXXX&time=XXXX&g
mt=XXXXX[&url=XXXX]
Parameter Description
Username Your SMS account username
Password Password of the username
Message Message to be sent
Destination Mobile number. More than one mobile number
needs to be separated by comma (,).
Type Type of the message
0 – Text
1 – Flash
2- Unicode
4 – WAP
6 – Unicode Flash
Source Sender ID
Date Scheduled date for the message. Data needs to be
in the following format:
MM/DD/YYYY
Example: 03/03/2013
Time Scheduled time for the message. Time needs to be
in the following format:
hh:mm am/pm
hh: Hours range from 00 to 12
mm: Examples of minutes: 00, 15,30
Example of scheduletime: 03:45 am OR 11:51 pm
Gmt GMT +hh:mm OR GMT -hh:mm OR
+hh:mm OR -hh:mm
hh: Hours range from 0 to 12
mm: Examples of minutes: 00 or 30
Example: GMT +1:30 OR -10:00
url URL is used in case of type=4 messages .In other
cases, it can be empty.
dlr Indicates whether client wants delivery report for
this message; 0 – No Report required, 1- Required.
Response codes for Schedule HTTP SMS API
#7. Sample coding of various platforms (Dot Net, PHP & Java)
Calling HTTP API Using .Net
Imports System.IO
Imports System.Net
Imports System.Data
Partial Class SendUsingSMPP
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal
e As System.EventArgs) Handles Me.Load
Dim WebRequest As Net.WebRequest 'object for
WebRequest Dim WebResonse As Net.WebResponse 'object
for WebResponse ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''
' DEFINE PARAMETERS USED IN URL
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''
'To what server you need to connect to for submission
'i.e. Dim Server As String = "xxxxx.xxxxx.xxxxx"
Dim Server As String = ""
'Port that is to be used like 8080 or 8000
Dim Port As String = "" 'Username that is
to be used for submission 'i.e. Dim
UserName As String = "tester" Dim
UserName As String = ""
' password that is to be used along with username
'i.e. Dim Password As String = "password"
Dim Password As String = ""
'1:means flash
'2:means Unicode (Message content should be in Hex)
'6:means Unicode Flash(Message content should be
in Hex) Dim type As Integer = 0 'Message content that
is to be transmitted
Dim Message As String = "Test Message"
'Url Encode message
Message = HttpUtility.UrlEncode(Message) If
(Message = 2) Or (Message = 6) Then
Message = ConvertToUnicode(Message)
End If
End Class
2. Calling HTTP API Using php:
<?php
class Sender{
var $host;
var $port;
/*
* Username that is to be used for submission
*/
var $strUserName;
/*
* password that is to be used along with username
*/
var
$strPassword; /*
* Sender Id to be used for submitting the message
*/
var
$strSender; /*
* Message content that is to be transmitted
*/
var $strMessage;
/*
* Mobile No is to be transmitted.
*/
var
$strMobile; /*
* What type of the message that is to be sent
* <ul>
* <li>0:means plain text</li>
* <li>1:means flash</li>
* <li>2:means Unicode (Message content should be in Hex)</li>
* <li>6:means Unicode Flash (Message content should be in Hex)</li>
* </ul>
*/
var $strMessageType;
/*
* Require DLR or not
* <ul>
* <li>0:means DLR is not Required</li>
* <li>1:means DLR is Required</li>
* </ul>
*/
var $strDlr;
private function sms unicode($message){
$hex1='';
if (function_exists('iconv')) {
$latin = @iconv('UTF-8', 'ISO-8859-1', $message);
if (strcmp($latin, $message)) {
$arr = unpack('H*hex', @iconv('UTF-8', 'UCS-
2BE', $message));
$hex1 = strtoupper($arr['hex']);
}
if($hex1 ==''){
$hex2='';
$hex='';
for ($i=0; $i < strlen($message); $i++){
$hex = dechex(ord($message[$i]));
$len =strlen($hex);
$add = 4 - $len;
if($len < 4){
for($j=0;$j<$add;$j++){
$hex="0".$hex;
}
}
$hex2.=$hex;
}
return $hex2;
}
else{
return $hex1;
}
}
else{
print 'iconv Function Not Exists !';
}
}
//Constructor..
public function Sender ($host,$port,$username,$password,
$sender, $message,$mobile,
$msgtype,$dlr){ $this->host=$host;
$this->port=$port;
$this->strUserName = $username;
$this->strPassword = $password;
$this->strSender= $sender;
$this->strMessage=$message; //URL Encode The Message..
$this->strMobile=$mobile;
$this->strMessageType=$msgtype;
$this->strDlr=$dlr;
}
public function Submit(){ if($this-
>strMessageType=="2" ||
$this->strMessageType=="6") {
//Call The Function Of String To HEX.
$this->strMessage = $this->sms unicode($this-
>strMessage); try{
//Smpp 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];
}catch(Exception $e){
echo 'Message:' .$e->getMessage();
}
}
else
$this->strMessage=urlencode($this->strMessage);
try{
//Smpp 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];
}
catch(Exception $e){
echo 'Message:' .$e->getMessage();
}
}
}
//Call The Constructor.
$obj = new Sender("IP","Port","","","Tester"," " ","
919990001245 ,"2","1");
$obj->Submit ();
?>
dataStreamFromUrl.close();
System.out.println("Response: " +
dataFromUrl); } catch (Exception ex) {
ex.printStackTrace();
} finally {
if (httpConnection != null) {
httpConnection.disconnect();
}
}
}
public static void main(String[] args)
{ try {
// Below exmaple is for sending Plain text
Sender s = new Sender("server", 8443, "xxxx",
"xxxx", "test for unicode", "1", "0",
"440000xxx", "Update"); s.submitMessage();
}
System.out.println(hexString);
return hexString;
}
private static void trustAllHttpsCertificates() throws Exception {
// Create a trust manager that does not validate certificate
chains: javax.net.ssl.TrustManager[] trustAllCerts =
new javax.net.ssl.TrustManager[1]; javax.net.ssl.TrustManager tm = new miTM();
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory( sc.getSoc
ketFactory());
}
public static class miTM implements javax.net.ssl.TrustManager,
javax.net.ssl.X509TrustManager { public
java.security.cert.X509Certificate[] getAcceptedIssuers()
{ return null;
}
public boolean
isServerTrusted( java.security.cert.X509Certifica
te[] certs) { return true;
}
public boolean isClientTrusted(
java.security.cert.X509Certificate[] certs) { return true;
}
public void
checkServerTrusted( java.security.cert.X509Certificate[]
certs, String authType) throws
java.security.cert.CertificateException {
return;
}
public void
checkClientTrusted( java.security.cert.X509Certificate[]
certs, String authType) throws
java.security.cert.CertificateException {
return;
}
}