Send SMS JSON
Description
Send SMS - HTTP POST
Usage
All requests has to be sent to URLs below.
In case of success, HTTP response code 200 is returned and message body contains response. In case of error, HTTP response error code is returned.
In case of success, HTTP response code 200 is returned and message body contains response. In case of error, HTTP response error code is returned.
Request
POST https://api.bsms.viamobile.sk/json/send - Send SMS
POST https://api.bsms.viamobile.sk/json/validate - Simulation of SMS send / validation
1.1 Message with simple text
Request
Parameter | Required | Type | Description |
---|---|---|---|
/username |
Required | String(32) | User login |
/password |
Required | String(32) | User password |
/message/text |
Required | String(480) | Message text |
/message/sender |
Optional | String(11) | Sender name, max. 11 characters
Default: InfoSMS |
/message/type |
Optional | Enum | gsm/utf8
gsm - standard SMS message (default, GSM7 alphabet). Text with max. 160 characters will be sent as 1 SMS, text over 160 characters will be sent as ceil(length(text)/153) SMSs utf8 - unicode message (UTF8 alphabet). Text with max. 70 characters will be sent as 1 SMS, text over 70 characters will be sent as ceil(length(text)/67) SMSs |
/message/time_to_send |
Optional | ISO timestamp | ISO timestamp in format YYYY-MM-DD HH:mm:ss, e.g. 2019-01-01T21:00:00
Default: now |
/recipients/msisdn |
Required | Int64 | Recipient MSISDN in international format without + or 00. E.g. 421903123456 |
/recipients/id |
Required | Int64 | Unique message ID from client system |
{
"username": "test",
"password": "test",
"message":
{
"text": "Text sms",
"sender": "InfoSMS",
"type": "gsm",
"time_to_send": "2019-01-01 21:00:00"
},
"recipients":
[
{"msisdn": 421903123456, "id": 123},
{"msisdn": 421903123457, "id": 124}
]
}
Response
Parameter | Required | Type | Description |
---|---|---|---|
/response/status | Required | Int32 | Server response (200 in case of success, 4xx in case of error) |
/response/recipients/id | Required | Int64 | Unique message ID from client system |
/response/recipients/status | Required | String | send status: ok - sent
blacklist - MSISDN blacklisted error - could not send/error notAllowed - MSISDN not permitted for testing network_disabled - destination network forbidded |
/response/recipients/price | Optional | Decimal | Message price (message can be divided into several multipart SMSs).
Null, if price not configured. |
/response/recipients/parts | Required | Int32 | Count of multipart SMSs. |
/response/recipients/duplicate | Optional | Boolean | Duplicate flag. |
{
"response":
{
"status": 200,
"recipients": [
{"id":"123","status":"ok", "parts":1, "price": 0.03},
{"id":"124","status":"blacklist"},
{"id":"125","status":"ok", "parts":1, "price": 0.03, "duplicate":true},
{"id":"126","status":"network_disabled"}
]
}
}
1.2 Message with Unicode text
Request
Parameter | Required | Type | Description |
---|---|---|---|
/username |
Required | String(32) | User login |
/password |
Required | String(32) | User password |
/message/text |
Required | String(480) | Message text |
/message/sender |
Optional | String(11) | Sender name, max. 11 characters
Default: InfoSMS |
/message/type |
Optional | Enum | gsm/utf8
gsm - standard SMS message (default, GSM7 alphabet). Text with max. 160 characters will be sent as 1 SMS, text over 160 characters will be sent as ceil(length(text)/153) SMSs utf8 - unicode message (UTF8 alphabet). Text with max. 70 characters will be sent as 1 SMS, text over 70 characters will be sent as ceil(length(text)/67) SMSs |
/message/time_to_send |
Optional | ISO timestamp | ISO timestamp in format YYYY-MM-DD HH:mm:ss, e.g. 2019-01-01T21:00:00
Default: now |
/recipients/msisdn |
Required | Int64 | Recipient MSISDN in international format without + or 00. E.g. 421903123456 |
/recipients/id |
Required | Int64 | Unique message ID from client system |
{
"username": "test",
"password": "test",
"message":
{
"text": "Text sms - ľščťžýáíé",
"sender": "InfoSMS",
"type": "utf8",
"time_to_send": "2019-01-01 21:00:00"
},
"recipients":
[
{"msisdn": 421903123456, "id": 123},
{"msisdn": 421903123457, "id": 124}
]
}
Response
Parameter | Required | Type | Description |
---|---|---|---|
/response/status | Required | Int32 | Server response (200 in case of success, 4xx in case of error) |
/response/recipients/id | Required | Int64 | Unique message ID from client system |
/response/recipients/status | Required | String | send status: ok - sent
blacklist - MSISDN blacklisted error - could not send/error notAllowed - MSISDN not permitted for testing network_disabled - destination network forbidded |
/response/recipients/price | Optional | Decimal | Message price (message can be divided into several multipart SMSs).
Null, if price not configured. |
/response/recipients/parts | Required | Int32 | Count of multipart SMSs. |
/response/recipients/duplicate | Optional | Boolean | Duplicate flag. |
{
"response":
{
"status": 200,
"recipients": [
{"id":"123","status":"ok", "parts":1, "price": 0.03},
{"id":"124","status":"blacklist"},
{"id":"125","status":"ok", "parts":1, "price": 0.03, "duplicate":true},
{"id":"126","status":"network_disabled"}
]
}
}
1.3 Message with custom text for each MSISDN
Request
Parameter | Required | Type | Description |
---|---|---|---|
/username |
Required | String(32) | User login |
/password |
Required | String(32) | User password |
/message/text |
Required | String(480) | Message text |
/message/sender |
Optional | String(11) | Sender name, max. 11 characters
Default: InfoSMS |
/message/type |
Optional | Enum | gsm/utf8
gsm - standard SMS message (default, GSM7 alphabet). Text with max. 160 characters will be sent as 1 SMS, text over 160 characters will be sent as ceil(length(text)/153) SMSs utf8 - unicode message (UTF8 alphabet). Text with max. 70 characters will be sent as 1 SMS, text over 70 characters will be sent as ceil(length(text)/67) SMSs |
/message/time_to_send |
Optional | ISO timestamp | ISO timestamp in format YYYY-MM-DD HH:mm:ss, e.g. 2019-01-01T21:00:00
Default: now |
/recipients/msisdn |
Required | Int64 | Recipient MSISDN in international format without + or 00. E.g. 421903123456 |
/recipients/id |
Required | Int64 | Unique message ID from client system |
/recipients/text |
Optional | String(480) | Custom text for MSISDN |
{
"username": "test",
"password": "test",
"message":
{
"text": "Text sms",
"sender": "InfoSMS",
"type": "gsm",
"time_to_send": "2019-01-01 21:00:00"
},
"recipients":
[
{"msisdn": 421903123456, "id": 123, "text": "Custom text for SMS ID 456123"},
{"msisdn": 421904123456, "id": 124}
]
}
Response
Parameter | Required | Type | Description |
---|---|---|---|
/response/status | Required | Int32 | Server response (200 in case of success, 4xx in case of error) |
/response/recipients/id | Required | Int64 | Unique message ID from client system |
/response/recipients/status | Required | String | send status: ok - sent
blacklist - MSISDN blacklisted error - could not send/error notAllowed - MSISDN not permitted for testing network_disabled - destination network forbidded |
/response/recipients/price | Optional | Decimal | Message price (message can be divided into several multipart SMSs).
Null, if price not configured. |
/response/recipients/parts | Required | Int32 | Count of multipart SMSs. |
/response/recipients/duplicate | Optional | Boolean | Duplicate flag. |
{
"response":
{
"status": 200,
"recipients": [
{"id":"123","status":"ok", "parts":1, "price": 0.03},
{"id":"124","status":"blacklist"},
{"id":"125","status":"ok", "parts":1, "price": 0.03, "duplicate":true},
{"id":"126","status":"network_disabled"}
]
}
}
2. Error codes
Error codes
HTTP Status code | Code | Message | Description |
---|---|---|---|
401 | 1000 | Unauthorized | Unknown username or password |
400 | 1011 | Unknown network | Carrier not permitted |
400 | 1012 | Unknown sender | Sender not permitted |
400 | 1013 | Message too long | Message is too long |
400 | 1014 | ID not integer | ID of message is not numeric |
400 | 2001 | SMS sending disabled | SMS sending is not allowed, please contact Viamobile to enable this funcionality |
400 | 2002 | Not enough credit | Not enough credit, please contact Viamobile |
500 | Unknown error | Unknown error - please contact Viamobile |
{
"response":
{
"status": 401,
"code": 1000,
"description": "Unauthorized"
}
}