REST-SMPP Intelligent Bridge API v2020-05-30T23:36:30Z
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Bridge between REST and SMPP for sending SMS.
Base URLs:
Email: Melrose Labs - Technical Support
Message
Submit
Code samples
# You can also use wget
curl -X POST https://api.melroselabs.com/restsmpp/message \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
const fetch = require('node-fetch');
const inputBody = '{
"smpp_account_config": {
"host": "string",
"port": 0,
"use_tls": false,
"smpp_version": 0,
"default_data_coding": "GSM",
"system_id": "string",
"password": "string",
"system_type": ""
},
"submit_options": {
"windowSizeSubmitSM": 1,
"quantityBindSessions": 1
},
"message": {
"service_type": "",
"source_addr": "string",
"source_addr_ton": 0,
"source_addr_npi": 0,
"esm_class": 0,
"protocol_id": 0,
"priority_flag": 0,
"schedule_delivery_time": "",
"validity_period": "",
"registered_delivery": 0,
"replace_if_present_flag": 0,
"data_coding": 0,
"short_message": {
"text": "string",
"ucs2": "string",
"base64": "string"
},
"tlvs": ""
},
"destinations": [
"string"
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('https://api.melroselabs.com/restsmpp/message',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('https://api.melroselabs.com/restsmpp/message', params={
}, headers = headers)
print r.json()
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.melroselabs.com/restsmpp/message', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.melroselabs.com/restsmpp/message");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post 'https://api.melroselabs.com/restsmpp/message',
params: {
}, headers: headers
p JSON.parse(result)
POST /message
Submit message.
Body parameter
{
"smpp_account_config": {
"host": "string",
"port": 0,
"use_tls": false,
"smpp_version": 0,
"default_data_coding": "GSM",
"system_id": "string",
"password": "string",
"system_type": ""
},
"submit_options": {
"windowSizeSubmitSM": 1,
"quantityBindSessions": 1
},
"message": {
"service_type": "",
"source_addr": "string",
"source_addr_ton": 0,
"source_addr_npi": 0,
"esm_class": 0,
"protocol_id": 0,
"priority_flag": 0,
"schedule_delivery_time": "",
"validity_period": "",
"registered_delivery": 0,
"replace_if_present_flag": 0,
"data_coding": 0,
"short_message": {
"text": "string",
"ucs2": "string",
"base64": "string"
},
"tlvs": ""
},
"destinations": [
"string"
]
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | SubmitSM | true | none |
» smpp_account_config | body | object | true | none |
»» host | body | string | true | Hostname or IP address of SMPP server (SMSC or SMS gateway) |
»» port | body | number | true | Port number of SMPP server (SMSC or SMS gateway) |
»» use_tls | body | boolean | false | Use TLS to encrypt SMPP session |
»» smpp_version | body | number | false | SMPP protocol version number (v3.3,3.4 or 5.0) |
»» default_data_coding | body | string | false | none |
»» system_id | body | string | true | System ID for SMPP account on SMPP server |
»» password | body | string | true | Password for SMPP account on SMPP server |
»» system_type | body | string | false | System Type for SMPP account on SMPP server |
» submit_options | body | object | false | none |
»» windowSizeSubmitSM | body | number | false | Window size for maximum number of SMS worker is awaiting response from SMPP server |
»» quantityBindSessions | body | number | false | Number of SMPP bind sessions from worker to SMPP server |
» message | body | object | true | Message to be sent to destination mobiles and the parameters related to message. Values are mapped directly to SMPP SubmitSM PDU, unless otherwise stated. |
»» service_type | body | string | false | none |
»» source_addr | body | string | true | none |
»» source_addr_ton | body | number | false | none |
»» source_addr_npi | body | number | false | none |
»» esm_class | body | number | false | none |
»» protocol_id | body | number | false | none |
»» priority_flag | body | number | false | none |
»» schedule_delivery_time | body | string | false | none |
»» validity_period | body | string | false | none |
»» registered_delivery | body | number | false | Delivery receipts requested (1) or not (0) |
»» replace_if_present_flag | body | number | false | none |
»» data_coding | body | number | false | none |
»» short_message | body | object | true | Short message payload to be sent to destination mobiles |
»»» text | body | string | false | Text in UTF-8 is converted to default character set of SMPP server or UCS2 if better representation, and data_coding is forced to 0 or 8 for default character set or UCS2 respectively. |
»»» ucs2 | body | string | false | Text in UTF-8 is converted to UCS2 and data_coding forced to UCS2 |
»»» base64 | body | string | false | Octets from unencoded base-64 string are mapped to short_message field of SMPP SubmitSM PDU. |
»» tlvs | body | string | false | Octets of SMPP TLVs to be added to submit_sm sent to SMPP server. Encode as Base64 string. |
» destinations | body | [string] | true | none |
»» Destination | body | string | false | Mobile telephone number |
Enumerated Values
Parameter | Value |
---|---|
»» default_data_coding | UCS2 |
»» default_data_coding | UTF-8 |
»» default_data_coding | GSM |
»» default_data_coding | ASCII |
»» default_data_coding | ISO8859-1 |
»» default_data_coding | ISO8859-15 |
Example responses
200 Response
{}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | 200 response | Empty |
Schemas
Empty
{}
Empty Schema
Properties
None
SubmitSM
{
"smpp_account_config": {
"host": "string",
"port": 0,
"use_tls": false,
"smpp_version": 0,
"default_data_coding": "GSM",
"system_id": "string",
"password": "string",
"system_type": ""
},
"submit_options": {
"windowSizeSubmitSM": 1,
"quantityBindSessions": 1
},
"message": {
"service_type": "",
"source_addr": "string",
"source_addr_ton": 0,
"source_addr_npi": 0,
"esm_class": 0,
"protocol_id": 0,
"priority_flag": 0,
"schedule_delivery_time": "",
"validity_period": "",
"registered_delivery": 0,
"replace_if_present_flag": 0,
"data_coding": 0,
"short_message": {
"text": "string",
"ucs2": "string",
"base64": "string"
},
"tlvs": ""
},
"destinations": [
"string"
]
}
SubmitSM Schema
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
smpp_account_config | object | true | none | none |
» host | string | true | none | Hostname or IP address of SMPP server (SMSC or SMS gateway) |
» port | number | true | none | Port number of SMPP server (SMSC or SMS gateway) |
» use_tls | boolean | false | none | Use TLS to encrypt SMPP session |
» smpp_version | number | false | none | SMPP protocol version number (v3.3,3.4 or 5.0) |
» default_data_coding | string | false | none | none |
» system_id | string | true | none | System ID for SMPP account on SMPP server |
» password | string | true | none | Password for SMPP account on SMPP server |
» system_type | string | false | none | System Type for SMPP account on SMPP server |
submit_options | object | false | none | none |
» windowSizeSubmitSM | number | false | none | Window size for maximum number of SMS worker is awaiting response from SMPP server |
» quantityBindSessions | number | false | none | Number of SMPP bind sessions from worker to SMPP server |
message | object | true | none | Message to be sent to destination mobiles and the parameters related to message. Values are mapped directly to SMPP SubmitSM PDU, unless otherwise stated. |
» service_type | string | false | none | none |
» source_addr | string | true | none | none |
» source_addr_ton | number | false | none | none |
» source_addr_npi | number | false | none | none |
» esm_class | number | false | none | none |
» protocol_id | number | false | none | none |
» priority_flag | number | false | none | none |
» schedule_delivery_time | string | false | none | none |
» validity_period | string | false | none | none |
» registered_delivery | number | false | none | Delivery receipts requested (1) or not (0) |
» replace_if_present_flag | number | false | none | none |
» data_coding | number | false | none | none |
» short_message | object | true | none | Short message payload to be sent to destination mobiles |
»» text | string | false | none | Text in UTF-8 is converted to default character set of SMPP server or UCS2 if better representation, and data_coding is forced to 0 or 8 for default character set or UCS2 respectively. |
»» ucs2 | string | false | none | Text in UTF-8 is converted to UCS2 and data_coding forced to UCS2 |
»» base64 | string | false | none | Octets from unencoded base-64 string are mapped to short_message field of SMPP SubmitSM PDU. |
» tlvs | string | false | none | Octets of SMPP TLVs to be added to submit_sm sent to SMPP server. Encode as Base64 string. |
destinations | [string] | true | none | none |
» Destination | string | false | none | Mobile telephone number |
Enumerated Values
Property | Value |
---|---|
default_data_coding | UCS2 |
default_data_coding | UTF-8 |
default_data_coding | GSM |
default_data_coding | ASCII |
default_data_coding | ISO8859-1 |
default_data_coding | ISO8859-15 |