XML Api 1.5.1.05
XML Api 1.5.1.05
XML Api 1.5.1.05
05
User Guide
1
2
Table of Contents
ValueFirst XML API 3
Guidelines for Sending Messages 3
Receiver Phone Number 3
Message Text 3
Sender ID 4
Encoding Procedure 4
Accessing Server Services 6
SMS-MT Service 7
a. SMS-MT Example of Sending Text Messages 7
b. SMS-MT Example of Response 8
c. Additional Parameters 8
d. SMS-MT Example of Sending Picture Messages 9
e. SMS-MT Example of Sending Ring tones 9
f. SMS-MT Example of Sending vCard (Business Card) 10
g. SMS-MT Example for Sending WAP Push 10
h. SMS-MT Example of Sending Unicode Text Messages 11
i. SMS-MT Example of Sending Message on Specified Port 12
SMS-SR Status Request Service 12
DLR URL 13
SMS-CR Service 14
SMS-CR Example of Credit Request 14
SMS-CR Example of Credit Request Response 14
Scheduling Framework 15
Scheduling Support in ValueFirst XML API 15
Setting up Messages for Future Delivery 15
Deleting Scheduled Message 16
Update Scheduled Message 16
List Scheduled Message 17
Standard Error Codes 18
Regulatory Implementation and Impact 20
Sender ID Regulation 20
National Customer Call Preference Registry (NCCPR) 21
www.vfirst.com
3
ValueFirst XML API provides an open HTTP and XML standards based API for integrating SMS
capabilities into any application or an enterprise system. ValueFirst XML API is a store and
forward mechanism for sending and receiving SMS through the API endpoint(s) to the clients.
ValueFirst XML API is specially designed for sending bulk messages through server-to-server
communication. This API is available in XML-based HTTP / HTTPS post format only.
ValueFirst XML API provides single authentication for multiple messages and target numbers.
The endpoint for this API is based on Message Queue architecture that provides high message
throughput.
Message Length
If a message is sent whose length is longer than permitted characters limit, it shall be counted as
multiple messages, however, will be delivered on handset as a single message.
• For standard Latin character set 160 characters per SMS is supported. If SMS text is
longer than 160 characters, messages shall be calculated in multiples of 153 characters.
• For Unicode messaging (non-English) only 70 characters per SMS is supported. If
Unicode SMS text is longer than 70 characters, messages shall be calculated in
multiples of 67 characters.
• For Binary messaging 140 characters including UDH is supported. If Binary SMS is
longer than 140 characters, messages shall be calculated in multiples of 134 characters.
www.vfirst.com
4
Sender ID
As per DOT and TRAI guideline, all alpha sender IDs and short-code sender ID will be prefixed by operator
and circle code. For sending SMS in India, alpha sender IDs of 6 characters only is allowed for transactional
SMS and numeric sender ID of 6 digits is allowed for promotional SMS. This has been done to make NCPR
(National Do Not Call) compliance easier. The details of operator/circle and corresponding prefixes are
mentioned at the end of the document.
For international mobile numbers, alpha numeric sender ID up to 16 characters is allowed.
Encoding Procedure
ValueFirst Server accepts all content in XML. As your message is an XML packet, special characters in
message text needs to be converted XML encoded. As a rule of thumb all string data should be XML
encoded as shown below:
Note: This is only required if you are posting data through a client application. Web browsers can
automatically convert the text to HTML encoded format. The encoding for sending message through
ValueFirst Pace Server requires two steps.
Step 1
The following table displays the codes that have to be replaced.
Code Replace with
#39 (single quote) &apos
#32 (space)  
#34 (double quote) "
> >
< <
#13 (Line feed) 
#10(form feed) 

#9(Tab) 	
Step 2
ValueFirst Server accepts all data as a form post. Therefore, it is required that all XML content needs to be
URL encoded before hitting ValueFirst Server.
Rules for encoding XML content to URL format:
1. Select for each character in messages.
2. If the ASCII value of the character is greater than 128 or smaller than 32 or the character is „*‟, „#‟,
„%‟, „<‟, „>‟ or „+‟, replace it with its corresponding hexadecimal (hereinafter Hex) value (2 digits with
leading zero) proceeded by a „%‟ character, e.g., space is encoded into %20.
• * is encoded into %2A
• # is encoded into %23
• % is encoded into %25
www.vfirst.com
5
Before Encoding
After Encoding
http://api.myvfirst.com/psms/servlet/psms.Eservice2?data=%3C?xml%20version=%221.0%22%20encoding=
%22ISO-8859-%22?%3E%3C!DOCTYPE%20 MESSAGE
%20SYSTEM%20%22http://127.0.0.1:80/psms/dtd/messagev12.dtd%22%20%3E%3CMESSAGE%3E%3C
USER%20USERNAME=%22test%22%20PASWORD=%22XXXXXX%22/%3E%3CSMS%20%20UDH=%22
0%22%20CODING=%221%22%20TEXT=%22The%20flight%20%23&btnG;%20<101>%20"DEL
"%20to%20"BLR"%20is%20delayed%20and%20it's%20%20revised%20time%20will
%20be%20informed%20later.%20Have%20a%20nice%20day!%22%20PROPERTY=%220%22%20ID=%22
1%22%3E%3CADDRESS%20FROM=%22ValueFirst%22%20TO=%2291XXXXXXXXXX%22%20SEQ=%22
1%22%20TAG=%22some%20clientside%20random%20data%22%20/%3E%3C/SMS%3E%3C/MESSAGE
%3E&action=send
Reference Links
For XML encoding
http://coderstoolbox.net/string/#!encoding=xml&action=encode&charset=iso_8859_1
www.vfirst.com
6
The above URL accepts data through two parameters namely “data” and “action”. The data
parameter specifies XML content that needs to be posted. The action parameter is different for
each XML (Table 2).
The complete example for a valid SMS-MT and SMS-SR is given in Figure 1.
www.vfirst.com
7
SMS-MT Service
ValueFirst XML API encompasses advance features specifically designed for sending bulk
messages. With this API, you do not have to send each message separately; multiple
messages can be sent together in a single transaction. The API also supports multiple target
numbers for a common message to the recipients.
www.vfirst.com
8
<MESSAGEACK>
<GUID GUID="kb4jc4243489a5f461209eo742--TESTUSER" SUBMITDATE="2017-05-
10 09:59:49" ID="1">
<ERROR SEQ="2" CODE="28682"/>
</GUID>
<GUID GUID="kb4jc4334130a5f461209l7t17--TESTUSER" SUBMITDATE="2017-05-10
09:59:49" ID="2"/>
</GUID>
</MESSAGEACK>
www.vfirst.com
9
c. Additional Parameters
Users can also pass additional parameters in XML as mentioned in below format. These
parameters will be stored at our end along with every message.
Here is an example for a valid SMS-MT request using ValueFirst XML API, with additional
parameters.
These parameters shall be added in the address tag between “Address” and “From”. Up to 5
additional parameters can be added.
Here is a complete example for a valid SMS-MT request using ValueFirst XML API
www.vfirst.com
10
<MESSAGE>
<USER USERNAME="mycompany" PASSWORD="mycompany"/>
<SMS UDH="1" CODING="3"
TEXT=";00481C01ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30
cc
f0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30c
c
f0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3c
cf
30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf
0f
30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf
0f
3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30
ccf0f30ccf0f3ccf30ccf0f30ccf0f3ccf30ccf0f30ccf0f3" PROPERTY="" ID="2">
<ADDRESS FROM=“VFIRST” TO="919812345678" SEQ="3" />
<ADDRESS FROM=“VFIRST” TO="919812345678" SEQ="6" />
</SMS>
</MESSAGE>
Here is a complete example for a valid SMS-MT request using ValueFirst XML API
www.vfirst.com
11
Here is a complete example of a valid SMS-MT request using ValueFirst XML API.
Here is a complete example for a valid SMS-MT request using ValueFirst XML API.
Ta Description
g
U UDH is used for sending binary messages. For WAP Push message the value
D
N should be 5.
H
a
C Extended type of messages. For text message the value should be 3.
od
m
in
e
g www.vfirst.com
12
Te Message Text must be in Hex characters for WAP Push and it can contain
xt message text along with URL.
For Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<MESSAGE>
<USER USERNAME="test" PASSWORD="test"/>
<SMS UDH="5" CODING="3"
TEXT="56616c75656669727374;7777772e7666697273742e636f"
PROPERTY="" ID="1">
<ADDRESS FROM=“VFIRST” TO="9198XXXXXXXXXX"
SEQ="3" TAG="some client side random data" />
</SMS>
</MESSAGE>
Shall sent a WAP Push with text “ValueFirst” and URL www.vfirst.com to
specified mobile number.
Tag Description
Name
UDH For text message the value should be 0.
Coding Extended type of messages. For Unicode text message the value should be
Text Message
2. text must be in Hex of Unicode characters. Message text can be up
70 characters for Unicode messages. API allows user to send Message Text
of more than 70 characters.
www.vfirst.com
13
Following table describes the usage of attributes and their values used in the above code:
Tag Description
UDH
Nam The UDH attribute must contain hexadecimal string as value. The length of hexadecimal
e string must be 14 or 24 alphanumeric characters long that also store the port number of
mobile phone device and where message is to be delivered.
Codin For port based messaging, “coding” attribute must store the value 3.
g
Text This attribute contains message content in the Hex or simple textual format.
The elements of the above XML example are explained in the following table.
Ta Description
g
GU A globally unique message ID that is generated for each <SMS> tag. This
Na
ID GUID is generated when ValueFirst Pace receives a new session.
me
Se The address (Mobile No.) SEQ ID whose status needs to be extracted. If no
q Status tag is sent the API shall return status of all Sequences in the specified
Transaction
Us User name of the sender of the message
er
Na
me
www.vfirst.com
14
Pa User password
ss
When the server receives SMS-SR query, it will respond with following XML:
wo
rd
<STATUSACK>
<GUID GUID="kb4jc5441583a5f461209hmvdf--TESTUSER">
<STATUS SEQ="1" ERR="8448" DONEDATE="2017-05-10 10:06:31"
REASONCODE="000">
<STATUS SEQ="2" ERR="8448" DONEDATE="2017-05-10 10:06:31"
REASONCODE="000" >
</GUID>
<GUID GUID="kb4jc5540144a5f461209het83--TESTUSER">
<STATUS SEQ="1" ERR="8448" DONEDATE="2017-05-10 10:06:31"
REASONCODE="000"/>
<STATUS SEQ="2" ERR="8449" DONEDATE="2017-05-10 10:06:37"
REASONCODE="009"/>
</GUID>
</STATUSACK>
The elements of the above XML are explained in the following table.
Tag Name Description
GUID A globally unique Message ID that is generated for each <SMS> tag. This
GUID is generated when ValueFirst Pace receives a new session.
SEQ The address (Mobile No.) SEQ ID (Client side value) whose status was
queried
DONEDATE The time when the new status was received. The new status could be
either success or failure, the field is in Standard ANSI format, i.e. YYYY- MM-DD HH:MM:SS
ERR Error / Message Status Code, if no standard error occurred, the ERR shall
be either one of the following value.
8448: Message was successfully delivered on DONEDATE
8449: Message reportedly failed on DONEDATE
REASONCODE In case of failure (8449) service returns reason code for message failure.
This is a value provided by SMSC and differs for each SMSC route. Customers are required
to contact ValueFirst to discuss various reason code and corresponding meaning for different
country.
Reason-code is an optional variable.
Note: If a promotional message delivery is tried on a user handset whose number exists in
NCPR database, the messages will fail immediately with error-code 009. ValueFirst will not
charge any credits for such events.
DLR URL
Users can pass DLR URL along with the SMS packet on which ValueFirst API will send the
DLR as soon as it is received at ValueFirst’s end. Below is the sample XML format for passing
DLR URL
Optionally this URL can be configured against a username from backend and this tag will not
be required to be sent along with every packet.
Below table depicts the parameter values to be passed to get corresponding values
www.vfirst.com
15
Note:
In the requested DLR URL, the attributes used in the URL can be named accordingly but
values used corresponding to used attributes or variables are case sensitive.
SMS-CR Service
The elements of the above XML are explained in the following table:
Tag Description
Nam
Use User name of the sender of
e
rNa
Pas the message
User password
me
sw
ord
www.vfirst.com
16
Cre Total
dit
Use credits
Credits
Limi
d assigned.
used.
t
Scheduling Framework
The API behaves methodically to the query and responds with GUID for the above SMS
group. The
GUID can later be used to perform additional actions on scheduled messages.
The future scheduling can only be done up to the contract expiry date or 1 year whichever
comes first.
Tag Description
Name
www.vfirst.com
17
SCHEDULE
ACTION Specify the type of action, for deleting the schedule use DELETE
USER action
USERNA Username for authentication
ME
PASSWO Password for authentication
RD
GUID
GUID Specify the SMS GUID against which the message was
MODIFIE scheduled
Specify additional parameter that applies to particular GUID. For
R Delete Schedule the Value of this field should be zero
For above query the system will respond with following XML
<SCHEDULE_RESPONSEERROR="0">
<GUID GUID="kb4jc3805296a5f461209jjt6l--TESTUSER" ERROR=""/>
</SCHEDULE_RESPONSE>
The following table describes the different elements of a SMS-MT request.
A previously scheduled message can be updated using following XML Post. Please note only
new date time can be specified. Other option like change of receiver’s numbers is not
supported.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE SCHEDULE SYSTEM "http://127.0.0.1:80/psms/dtd/schedule_q.dtd">
<SCHEDULEACTION="UPDATE">
<USER USERNAME="mycompany" PASSWORD="mycompany"/>
<GUID GUID="kb4jc3847730a5f461209zfosl--TESTUSER" MODIFIER="2009-10-24
20:10:00 GMT+5:30"/>
</SCHEDULE>
www.vfirst.com
18
MODIFIER Specify additional parameter that applies to GUID. The field must
contain the new date time that need to be setup.
For above query the system will respond with following XML
<SCHEDULE_RESPONSEERROR="0">
<GUID GUID="kb4jc3922236a5f461209p7vmd--TESTUSER" ERROR=""/>
</SCHEDULE_RESPONSE>
www.vfirst.com
19
END_DATE Specify the end date of execution for scheduled messages for
PROCESSED/PENDING/ERROR while end date of setup of schedule for SCHEDULED
messages
GUID Specify a GUID for which details are requested. When GUID take is used
START_DATE, END_DATE become irrelevant.
For above query the system will respond with following XML
<SCHEDULE_LIST_RESPONSEERROR=”0”>
<GUID GUID=”kb4jc3956390a5f461209iokjw—TESTUSER” ERROR=””
CREDIT_USED=”” ADDRESS=”” SCHEDULED_ON=”” EXECUTED_ON=””/>
</SCHEDULE_LIST_RESPONSE>
All errors that may come across in ValueFirst XML API are listed below.
www.vfirst.com
20
28683 Invalid Date time for message Schedule (If the date specified in
message post for schedule delivery is less than current date or more
than expiry date or more than 1 year)
Status Request
8448 Message delivered successfully
8449 Message failed
8450 Message ID is invalid
Scheduler Related
13568 Command completed successfully
13569 Cannot update/delete schedule since it has already been processed
13570 Cannot update schedule since the new date-time parameter is incorrect
Note: There isn’t any status returned in case message is in waiting status. Therefore, there
would not be any status tag in XML in case of waiting status.
“Reason for failure” codes are SMSC specific and hence are not covered here.
www.vfirst.com
21
The Identification Code will be of three characters, consisting, Service Provider Code and
Service Area Code, followed by a Hyphen character. Hence, the maximum length of a sender
ID has been fixed to 6 characters for alpha and numeric both.
www.vfirst.com
22
www.vfirst.com