var api = require('./api.js');
var smsApi = new api.SMSApi("USERNAME", "API_KEY");
var smsMessage = new api.SmsMessage();
smsMessage.source = "sdk";
smsMessage.to = "+0451111111";
smsMessage.body = "test message";
var smsCollection = new api.SmsMessageCollection();
smsCollection.messages = [smsMessage];
smsApi.smsSendPost(smsCollection).then(function(response) {
console.log(response.body);
}).catch(function(err){
console.error(err.body);
});
from __future__ import print_function
import AbleMobie_client
from AbleMobie_client import SmsMessage
from AbleMobie_client.rest import ApiException
# Configure HTTP basic authorization: BasicAuth
configuration = AbleMobie_client.Configuration()
configuration.username = 'USERNAME'
configuration.password = 'API_KEY'
# create an instance of the API class
api_instance = AbleMobie_client.SMSApi(AbleMobie_client.ApiClient(configuration))
# If you want to explicitly set from, add the key _from to the message.
sms_message = SmsMessage(source="php",
body="Jelly liquorice marshmallow candy carrot cake 4Eyffjs1vL.",
to="+61411111111",
schedule=1436874701)
sms_messages = AbleMobie_client.SmsMessageCollection(messages=[sms_message])
try:
# Send sms message(s)
api_response = api_instance.sms_send_post(sms_messages)
print(api_response)
except ApiException as e:
print("Exception when calling SMSApi->sms_send_post: %s\n" % e)
package AbleMobie;
import java.util.Arrays;
import java.util.List;
import AbleMobie.Api.SmsApi;
import AbleMobie.Model.SmsMessage;
import AbleMobie.Model.SmsMessageCollection;
public class send_sms {
public static void main(String[] args) {
ApiClient defaultClient = new ApiClient();
defaultClient.setUsername("USERNAME");
defaultClient.setPassword("API_KEY");
SmsApi apiInstance = new SmsApi(defaultClient);
SmsMessage smsMessage = new SmsMessage();
smsMessage.body("body");
smsMessage.to("to");
smsMessage.source("source");
List<SmsMessage> smsMessageList = Arrays.asList(smsMessage);
// SmsMessageCollection | SmsMessageCollection model
SmsMessageCollection smsMessages = new SmsMessageCollection();
smsMessages.messages(smsMessageList);
try {
String result = apiInstance.smsSendPost(smsMessages);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SmsApi#smsSendPost");
e.printStackTrace();
}
}
}
using IO.AbleMobie.AbleMobie.Api;
using IO.AbleMobie.Client;
using IO.AbleMobie.AbleMobie.Model;
var configuration = new Configuration()
{
Username = USERNAME,
Password = API_KEY
};
var smsApi = new SMSApi(configuration);
var listOfSms = new List<SmsMessage>
{
new SmsMessage(
to: "+61411111111",
body: "test message",
source: "sdk"
)
};
var smsCollection = new SmsMessageCollection(listOfSms);
var response = smsApi.SmsSendPost(smsCollection);
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: BasicAuth
$config = AbleMobie\Configuration::getDefaultConfiguration()
->setUsername('USERNAME')
->setPassword('API_KEY');
$apiInstance = new AbleMobie\Api\SMSApi(new GuzzleHttp\Client(),$config);
$msg = new \AbleMobie\Model\SmsMessage();
$msg->setBody("test body");
$msg->setTo("0451111111");
$msg->setSource("sdk");
// \AbleMobie\Model\SmsMessageCollection | SmsMessageCollection model
$sms_messages = new \AbleMobie\Model\SmsMessageCollection();
$sms_messages->setMessages([$msg]);
try {
$result = $apiInstance->smsSendPost($sms_messages);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling SMSApi->smsSendPost: ', $e->getMessage(), PHP_EOL;
}
?>
# load the gem
require 'AbleMobie_client'
require 'json'
# setup authorization
AbleMobieClient.configure do |config|
# Configure HTTP basic authorization: BasicAuth
config.username = 'USERNAME'
config.password = 'API_KEY'
end
api_instance = AbleMobieClient::SMSApi.new
# SmsMessageCollection | SmsMessageCollection model
sms_messages = AbleMobieClient::SmsMessageCollection.new
sms_messages.messages = [
AbleMobieClient::SmsMessage.new(
"to": "+61411111111",
"source": "sdk",
"body": "body"
),
AbleMobieClient::SmsMessage.new(
"to": "+61422222222",
"source": "sdk",
"body": "body"
)
]
begin
# Send sms message(s)
result = api_instance.sms_send_post(sms_messages)
p JSON.parse(result)
rescue AbleMobieClient::ApiError => e
puts "Exception when calling SMSApi->sms_send_post: #{e.response_body}"
end
import Alamofire
if let authHeader = Request.authorizationHeader(user: "USERNAME", password: "PASSWORD") {
AbleMobieClientAPI.customHeaders = [authHeader.key : authHeader.value]
}
let message1 = SmsMessage(body: "Chocolate bar icing icing oat cake carrot cake jelly cotton MWEvciEPIr.",
to: "+0451111111",
source: "swift")
let message2 = SmsMessage(body: "Chocolate bar icing icing oat cake carrot cake jelly cotton MWEvciEPIr.",
source: "swift",
listId: 1234)
let smsCollection = SmsMessageCollection(messages: [message1, message2])
SMSAPI.smsSendPost(smsMessages: smsCollection) { (dataString, error) in
guard let dataString = dataString else {
print(error!)
return
}
if let data = dataString.data(using: String.Encoding.utf8) {
do {
if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
print(dictonary)
} else {
print("bad json")
}
} catch let error as NSError {
print(error)
}
}
}