SMS#
Acceptable data types when sending a request:
text data are transmitted as a text SMS message;
binary data are transmitted in the body of SMS message.
Sending Request#
POST and GET requests are allowed in the HTTP API.
Request Examples#
POST request with a message in Latin “test“ in a simple text format.
{
POST /login HTTP/1.1
Host: 10.10.10.10:9080
Content-Type: application/x-www-form-urlencoded;charset=utf-8
Content-Length: 58
serviceId=login&pass=123&clientId=79161234567&message=test
}
POST request with the text of the message in Cyrillic “тест“ in URL format.
{
POST /login HTTP/1.1
Host: 10.241.0.194:9080
Content-Type: application/x-www-form-urlencoded;charset=utf-8
Content-Length: 78
serviceId=login&pass=123&clientId=79161234567&message=%D1%82%D0%B5%D1%81%D1%82
}
GET request with a message in Latin “test“ in a simple text format.
{
http://partner.ru/login?clientId=79161234567&message=test&pass=123&serviceId=login
}
GET request with the text of the message in Cyrillic “тест“ in URL format.
{
http://partner.ru/login?clientId=79161234567&message=%D1%82%D0%B5%D1%81%D1%82&pass=123&serviceId=login
}
Request Parameters#
The parameters are applicable for POST and GET requests.
Parameter |
Required |
Type |
Description |
|---|---|---|---|
clientId |
yes |
string |
Subscriber’s phone number, no more than 25 characters. More details
Examples: |
message |
yes |
string |
Message to send to the subscriber. More detailsTo send in this parameter:
Maximum allowed message length for SMS: 2000 characters. Important When sending SMS messages with the |
serviceId |
yes |
string |
ID of the Partner’s service (login), which is used to send a message. More details
The Service Provider establishes |
pass |
yes |
string |
Password for authorization in the service. More detailsThe Service Provider establishes the password while enabling the service and reports it to the Partner. |
ptag |
no |
string |
Message identifier in the Partner’s system. More detailsIt may contain from 1 to 50 characters. Valid characters: 0...9a...zA...Z- It may be any identifier in the Partner's system. Note For example, it may be the unique identifier of a message or the identifier of
subdivision, which initiates the request for sending. In contrast to the
The Service Provider optionally returns this identifier to the Partner as part of the request for receiving the message delivery status (this functionality is described in the section Delivery Status Service). |
sending_time |
no |
string |
Local time to send a message to a subscriber. More details
Specified in the Warning If the parameter is specified, then its value cannot be empty. Note For example, if the parameter value is
The time zone of the subscriber is determined not by actual location of the subscriber.
If the Partner doesn't send the
If the Partner sends the time zone in the |
time_zone |
no |
string |
Time zone of the subscriber. More details
Specified in the If the Partner sends the value time zone in this parameter, the message will be sent to the subscriber according to local time of this time zone, otherwise the time zone of the subscriber will be determined by the subscriber's phone number. Note The subscriber with the number from Khabarovsk is in Moscow. The following sending options are available:
For the zero zone it is necessary to specify a "+" or "–" sign.
The "+" sign will be transformed into |
flash |
no |
string |
Attribute of sending Flash-SMS. More details
If
If the parameter is missing or not equal to
The maximum length of SMS messages with the
|
source |
no |
string |
Service name of the sender. More detailsThis parameter is optional. If the parameter is missing in the request, the message will be sent to the subscriber from the default service name (setting on the Service Provider's side). Important This parameter is not available for the Partner by default. This feature can be activated only after approval by the Service Provider. In this case, the list of allowed sender names is set for the Partner's service or the dynamic signature feature is activated. |
output |
no |
string |
Request response format. More details
If If the parameter is not defined or is different, the default format is used: text/plain (see Response to the request). |
partnerMsgId |
no |
string |
Message unique identifier in the Partner’s system. More detailsAllowed length: from 1 to 50 characters.
This parameter is required for resending and duplicate control.
The Partner can send a request to send a message several times with the same
In this case:
The Service Provider as an option returns this identifier to the Partner as part of the request for receiving the message delivery status (see section Delivery Status Service). This parameter is not available by default. To enable this functionality, please consult with your manager. |
smsPriority |
no |
integer |
Parameter indicates the priority of the message. More detailsMessages with a higher priority are sent to the operator first. Possible values:
This parameter is not available by default. The connection of this functionality should be agreed with your supervising manager. |
shortenLinks |
no |
boolean |
Parameter controls the automatic shortening of long links in the message. More detailsImportant It is used for single messages only.
If cascade resending, you need to use the Important This option is not available by default. The connection of this functionality should be agreed with your supervising manager. For more details: see Link Shortening Service. |
Requests with Binary Data#
When transmitting binary data, a sequence of bytes in the hexadecimal number system is transmitted in the message text.
To send binary data in a POST or GET request, you need to indicate additional parameters specified in the table below.
Request Examples#
{
POST /login HTTP/1.1
Host: 10.241.0.194:9080
Content-Type: application/x-www-form-urlencoded;charset=utf-8
Content-Length: 208
serviceId=login&pass=123&clientId=79161234567&message=0605040b8423f0dc0601ae02056a0045c60b03687474703a2f2f7761702e7A616772757A6B612e636F6D0001035A616772757A6B6155524C000101&smpp_encoding=245&smpp_esm_class=64
}
{
http://partner.ru/login?clientId=79161234567&message=0605040b8423f0dc0601ae02056a0045c60b03687474703a2f2f7761702e7A616772757A6B612e636F6D0001035A616772757A6B6155524C000101&serviceId=login&pass=123&smpp_encoding=245&smpp_esm_class=64
}
Parameters for Binary Data#
Parameters for binary data sending in a request.
Parameter |
Required |
Type |
Description |
|---|---|---|---|
message |
yes |
string |
Message to be sent to the subscriber. More detailsWhen sending binary data, the parameter contains a sequence of bytes in hexadecimal representation (standard HEX Decimal). Other characters in the text is unacceptable. To send a binary SMS message, the text must be in UTF-8 encoding. Maximum allowed message length for SMS: 2000 characters. |
smpp_encoding |
no |
integer |
Interpretation of data More detailsFor the correct delivery of a binary SMS message additional parameters in the request must be transmitted that ensure the correct interpretation of the data after sending using the SMPP protocol version 3.4. For certain types of messages, one of the parameters (or both at the same time) is specified.
Many of the values for these parameters are specified by SMPP version
3.4 in sections for the
When sending a binary message to a subscriber, the specified values
of the
If none of the |
smpp_esm_class |
no |
integer |
Response#
Note
The Service Provider sends messages to subscribers only if the request is successfully processed.
Response in the Text Format#
Successful Sending#
In case of successful processing of the request the Service Provider returns to the Partner:
HTTP code
200 OK;the ID of the message in the Service Provider’s system.
{
OK
4095284974
}
Response Code |
Description |
Possible Partner’s action |
|---|---|---|
200 |
Successful processing of the request.
In the body of the response, the identifier assigned
to the message by the Service Provider is transmitted.
The identifier is a 64-bit positive integer.
|
Common action with the service. |
Sending Errors#
When sending an incorrect request, a short text error message may be transmitted in the response body.
An example of an error response – invalid serviceId/pass combination:
{
Invalid password
}
Response Code |
Description |
Possible Partner’s action |
|---|---|---|
400 |
Mandatory parameters are unavailable or they are set incorrectly. More details
For example, the |
TroubleshootingPlease repeat the request with the correct combination of parameters and their correct values. |
401 |
Incorrect combination of |
Troubleshooting
Please repeat the request with the correct |
402 |
The balance of paid messages has been exhausted (for Partners working on prepaid). |
TroubleshootingTo resume sending messages, the Partner needs to make an advance payment and contact your supervising manager. The Partner shouldn't repeat the request. |
403 |
The service with the |
TroubleshootingPlease contact your supervising manager. The Partner shouldn't repeat the request. |
406 |
Impossible to send a message to a subscriber with
|
TroubleshootingThe Partner shouldn't repeat the request. |
408 |
Allowable rate of message sending is exceeded. More detailsNote The Partner's service is set to a permissible
speed of 10 requests per second. The Partner
sent 12 requests per second. The first 10
requests will be successfully processed: in
response to these requests the Service Provider
will return the |
TroubleshootingThe Partner can repeat the request without exceeding the allowed rate. |
409 |
Sending duplicates prohibited. More detailsNote The duplicate blocking feature is activated
for the Partner's service. During 24 hours
the Partner sent 3 requests to send the
message with the same text to the same number.
The first request will be processed
successfully and the message will be sent to
the subscriber. In response to the last 2
requests the Service Provider will return the
The duplicate blocking feature is deactivated for the Partner by default. The feature can be activated by the Partner's request. The Service Provider can also activate the duplicate blocking feature for the Partner, if necessary: for example, in case of subscribers complaints. |
TroubleshootingThe Partner shouldn't repeat the request. If it is necessary to send a duplicate message, the Partner can contact the Technical Support Service and provide it with the most complete information about the conditions for this situation. |
414 |
The allowed length of the message body sent in the
|
TroubleshootingThe Partner can repeat the request after shortening the message text to the allowed length. |
500 |
Server internal error. Technical difficulties at the Service Provider side. |
Troubleshooting
When receiving the
If you receive the |
503 |
The request is being currently processed. More details
The error might appear if the Partner almost
simultaneously sends several requests with
the same
Until the first request is processed the
Service Provider will return the
|
Troubleshooting
The Partner should wait for a response to the first request with
the The Partner can repeat the request if the first request is not answered. |
Response in the XML Format#
output = ml parameter in the body of the request.200— the request was successfully processed;500— internal server error, technical problems on the Service Provider’s side.
Response Examples#
Response example in XML format in case of successful request sending (HTTP code 200).
{
<?xml version="1.0" encoding="utf-8"?>
<response>
<code>200</code>
<text>OK</text>
<payload>
<id>4095284976</id>
</payload>
</response>
}
Response example in XML format in case of error request sending: invalid combination of serviceId/pass.
{
<?xml version="1.0" encoding="utf-8"?>
<response>
<code>401</code>
<text>Invalid password</text>
</response>
}
When receiving the 500 status or when the timeout of waiting for a response expires, the Partner needs to wait for at least 1 minute.
After the pause, the Partner can repeat the request.
Note
When receiving the 500 status more than 10 times, the request transmitting should be stopped. After that, the Partner needs to provide the
Technical Support Service with the most complete information about the conditions
for the occurrence of this error for further analysis.
Name |
Required |
Description |
Note |
|---|---|---|---|
xml version |
yes |
Number of XML version. |
It is contained in the prologue of the XML document. |
encoding |
no |
Encoding. |
It is contained in the prologue of the XML document. |
response |
yes |
A root element. It contains the
|
|
code |
yes |
A response code (values correspond to HTTP codes for responses of type text/plain). |
For more details see section “Response to the request“. |
text |
no |
Additional brief textual information about the response. |
It may contain an error information. |
payload |
no |
Information about the message, contains the
|
Would be sent only if the request is
performed successfully
(when |
id |
no |
The identifier assigned to the message by the Service Provider. The identifier is a 64-bit positive integer. |
SMS Delivery Statuses#
To receive message statuses, you need to set up the Delivery Status Service.
Delivery Error Codes#
Delivery error codes for each message type are provided in the corresponding tab of the Error codes (parameter unifiedExtStatus) section.