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 http://api.viamobile.sk/bsms/rest/v2/json/send - Send SMS
POST http://api.viamobile.sk/bsms/rest/v2/json/validate - Simulation of SMS send / validation
1.1 Message with text
{
"username": "test",
"password": "test",
"message":
{
"text": "Text sms",
"sender": "InfoSMS"
},
"recipients":
[
{"msisdn": 421903123456, "id": 123},
{"msisdn": 421903123457, "id": 124}
]
}
1.2 Message with Unicode characters
{
"username": "test",
"password": "test",
"message":
{
"text": "Text sms - ľščťžýáíé",
"type": "utf8",
"sender": "InfoSMS"
},
"recipients":
[
{"msisdn": 421903123456, "id": 123},
{"msisdn": 421903123457, "id": 124}
]
}
1.3 Flash message
{
"username": "test",
"password": "test",
"message":
{
"text": "Text sms",
"sender": "InfoSMS",
"flash": 1
},
"recipients":
[
{"msisdn": 421903123456, "id": 123},
{"msisdn": 421903123457, "id": 124}
]
}
1.4 Message with custom text for MSISDN
{
"username": "test",
"password": "test",
"message":
{
"text": "Text sms",
"sender": "InfoSMS"
},
"recipients":
[
{"msisdn": 421903123456, "id": 123, "text": "Custom text for SMS ID 456123"},
{"msisdn": 421904123456, "id": 124}
]
}
Parameter | Required | Type | Description |
---|---|---|---|
username |
required | string(32) | user login |
password |
required | string(32) | user password |
Message | |||
text |
required | string | SMS text. ASCII/UTF8 encoding (depends on type) |
type |
optional | 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 |
sender |
optional | string(11) | sender name, max. 11 characters |
flash |
optional | int | Flash message. Yes 1, No 0 |
Recipients | |||
msisdn |
required | integer | recipient MSISDN |
id |
required | int64 | SMS unique ID |
text |
optional | string | Custom text for MSISDN |
Response
{
"response":
{
"status": 200,
"recipients": [
{"id":"123","status":"ok"},
{"id":"124","status":"blacklist"},
{"id":"125","status":"ok", "duplicate":true},
{"id":"126","status":"network_disabled"}
]
}
}
Parameter | Type | Description |
---|---|---|
status | integer | server response (200 in case of success, 4xx in case of error) |
description | varchar (300) | error description |
recipients | array |
send status: ok-sent, blacklist-MSISDN blacklisted, error-could not send/error
notAllowed - MSISDN not permitted for testing network_disabled - destination network forbidded |
Error response
{
"response":
{
"status": 401,
"code": 1000,
"description": "Unauthorized"
}
}
Error codes
HTTP Status code | Code | Message | Info |
---|---|---|---|
401 | 1000 | Unauthorized | unknown username or password |
400 | 1010 | unknown prefix | unknown prefix, please use valid carrier prefix |
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 |
Versions
Version | Date | Description |
---|---|---|
1.0 | 1.2.2014 | initial version |
2.0 | 13.8.2014 | unicode sms, multipart sms, flash sms |