{% raw %}
Click and play around to learn more about Bandwidth's APIs
Learn more
{% endraw %}
var body = new BandwidthMessaging.MessageRequest({
"applicationId": applicationId ,
"to": ["+19999999999"],
"from": "+18888888888",
"text": "The quick brown fox jumps over a lazy dog."
});
var response = await messagingController.createMessage(msgUserId, body);
console.log(response);
MessageRequest msgReq = new MessageRequest();
List<String> toNumbers = new ArrayList<>();
toNumbers.add("+19999999999");
msgReq.setTo( toNumbers );
msgReq.setFrom("+18888888888");
msgReq.setApplicationId("1-2-3");
msgReq.setText("Hello World");
try {
ApiResponse<BandwidthMessage> response = msgController.createMessage(accountId, messageRequest);
System.out.println(response.getResult().getId());
} catch (ApiException | IOException e){
//Handle
}
MessageRequest msgRequest = new MessageRequest();
msgRequest.ApplicationId = applicationId;
msgRequest.From = "+18888888888";
msgRequest.To = new string[1] {"9199199999"};
msgRequest.Text = "The quick brown fox jumps over a lazy dog.";
msgController.CreateMessage(msgUserId, msgRequest);
account_id = "1"
body = MessageRequest.new
body.application_id = "1-2-3"
body.to = ["+17777777777"]
body.from = "+18888888888"
body.text = "Hello from Bandwidth"
result = message_controller.create_message(account_id,:body => body)
curl -X POST \
--url 'https://messaging.bandwidth.com/api/v2/users/{accountId}/messages' \
-u '{username}:{password}' \
-H 'Content-type: application/json' \
--data-raw '
{
"to" : ["+12345678902"],
"from" : "+12345678901",
"text" : "Hey, check this out!",
"applicationId" : "93de2206-9669-4e07-948d-329f4b722ee2",
"tag" : "test message"
}
'
account_id = "123"
body = MessageRequest()
body.application_id = "1-d-b"
body.to = ["+17777777777"]
body.mfrom = "+18888888888"
body.text = "Greetings!"
result = messaging_client.create_message(account_id, body=body)
$body = new BandwidthLib\Messaging\Models\MessageRequest();
$body->applicationId = "93de2206-9669-4e07-948d-329f4b722ee2";
$body->to = array("+12345678902");
$body->from = "+12345678901";
$body->text = "Hey, check this out!";
$response = $messagingClient->createMessage($messagingAccountId, $body);
var body = new BandwidthVoice.ApiCreateCallRequest({
"from": "+19999999999",
"to": "+18888888888",
"applicationId": "123",
"answerUrl": "https://test.com",
"answerMethod": "POST",
"callTimeout": 30
});
var response = await voiceController.createCall(accountId, body);
console.log(response);
ApiCreateCallRequest callRequest = new ApiCreateCallRequest();
callRequest.setApplicationId("3-d-4-b-5");
callRequest.setFrom("+17777777777");
callRequest.setTo("+19999999999");
callRequest.setAnswerUrl("https://test.com");
try {
ApiResponse<ApiCallResponse> response = voiceController.createCall(accountId, callRequest);
System.out.println(response.getResult().getCallId());
} catch (IOException | ApiException e) {
//Handle
}
callRequest.ApplicationId = "3-d-4-b-5";
callRequest.To="+19999999999";
callRequest.AnswerUrl= "https://test.com";
callRequest.From="+17777777777";
//Be aware that the Voice Client can throw exceptions
voiceController.CreateCall(accountId, callRequest);
account_id = '1'
body = ApiCreateCallRequest.new
body.from = '+16666666666'
body.to = '+17777777777'
body.answer_url = 'https://test.com'
body.application_id = '3-d-4-b-5'
result = voice_client.create_call(account_id,:body => body)
curl -X POST \
--url 'https://voice.bandwidth.com/api/v2/accounts/{accountId}/calls' \
-u '{username}:{password}' \
-H 'Content-type: application/json' \
--data-raw '
{
"from" : "+19195551212",
"to" : "+19195551313",
"answerUrl" : "http://www.myapp.com/hello",
"applicationId" : "7fc9698a-b04a-468b-9e8f-91238c0d0086"
}'
account_id = "123"
body = ApiCreateCallRequest()
body.mfrom = "+17777777777"
body.to = "+16666666666"
body.application_id = "3-d-4-b-5"
body.answer_url = "https://test.com"
result = voice_client.create_call(account_id, body=body)
$body = new BandwidthLib\Voice\Models\ApiCreateCallRequest();
$body->from = "+15554442222";
$body->to = "+15554443333";
$body->answerUrl = "https://test.com";
$body->applicationId = "3-6-4-a";
$response = $voiceClient->createCall($accountId, $body);
curl -X POST \
--url 'https://dashboard.bandwidth.com/api/accounts/{accountId}/orders' \
-u '{username}:{password}' \
-H 'Content-type: application/xml; charset=utf-8' \
--data-raw '
<Order>
<AreaCodeSearchAndOrderType>
<AreaCode>910</AreaCode>
<Quantity>1</Quantity>
</AreaCodeSearchAndOrderType>
<SiteId>{Site-ID}</SiteId>
</Order>
'
// Coming Soon
// Coming Soon
## Coming Soon
## Coming Soon
// Coming soon
{% raw %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script> $(document).ready(function setup() { /* Removed if(gitbook){ gitbook.events.bind('page.change', function() { landing(); } ); } */ landing(); }); function landing(){ if (window.innerWidth >= 980) { // Adding classes for sms, voice and pns $('#send-a-message').nextUntil('h3').addClass('smstut'); $('#send-a-message').addClass('smstut'); $('#make-a-call').nextUntil('h3').addClass('voicetut'); $('#make-a-call').addClass('voicetut'); $('#buy-a-telephone-number').nextUntil('div').addClass('pntut'); $('#buy-a-telephone-number').addClass('pntut'); // Access to parent div on this page only $('#hero').parent().addClass('landingpage'); // Setting default language $('.lang-bash').parent().addClass('active'); // Toggle between languages $('code').not('.lang-bash').parent().hide(); $('li pre').show(); $('.trigger').click(function() { $('code').parent().removeClass('active'); $('.' + $(this).data('rel')).parent().addClass('active'); if ($('#voicecard').hasClass('active')){ tuts.hide(); $('.voicetut.active').show(); } if ($('#smscard').hasClass('active')){ tuts.hide(); $('.smstut.active').show(); } else if ($('#pncard').hasClass('active')){ tuts.hide(); $('.pntut.active').show(); } }); // Showing proper code sample or sms, voice and pns var tuts = $('.voicetut, .smstut, .pntut'); tuts.hide(); // Disable buttons on cards that are inactive $('.devCards.active').find('.fulltut').prop("disabled",false); $('#smsexpand').click(function(){ tuts.hide(); $('.smstut.active').show(); $('.devCards').removeClass('active'); $(this).parent().addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('#voiceexpand').click(function(){ tuts.hide(); $('.voicetut.active').show(); $('.devCards').removeClass('active'); $(this).parent().addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('#pnexpand').click(function(){ tuts.hide(); $('.pntut.active').show(); $('.devCards').removeClass('active'); $(this).parent().addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('.smstut.active').show(); // Mobile } else { // Adding classes for sms, voice and pns $('#send-a-message').nextUntil('h3').addClass('smstut'); $('#send-a-message').addClass('smstut'); $('#make-a-call').nextUntil('h3').addClass('voicetut'); $('#make-a-call').addClass('voicetut'); $('#buy-a-telephone-number').nextUntil('div').addClass('pntut'); $('#buy-a-telephone-number').addClass('pntut'); // Access to parent div on this page only $('#hero').parent().addClass('landingpage'); // Setting default language $('.lang-bash').parent().addClass('active'); // Toggle between languages $('code').not('.lang-bash').parent().hide(); $('li pre').show(); $('.trigger').click(function() { $('code').parent().removeClass('active'); $('.' + $(this).data('rel')).parent().addClass('active'); if ($('#voicecard').hasClass('active')){ tuts.hide(); $('.voicetut.active').show(); } if ($('#smscard').hasClass('active')){ tuts.hide(); $('.smstut.active').show(); } else if ($('#pncard').hasClass('active')){ tuts.hide(); $('.pntut.active').show(); } }); // Showing proper code sample or sms, voice and pns var tuts = $('.voicetut, .smstut, .pntut'); tuts.hide(); // Disable buttons on cards that are inactive $('.devCards.active').find('.fulltut').prop("disabled",false); $('#smscard').click(function(){ tuts.hide(); $('.smstut.active').show(); $('.devCards').removeClass('active'); $(this).addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('#voicecard').click(function(){ tuts.hide(); $('.voicetut.active').show(); $('.devCards').removeClass('active'); $(this).addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('#pncard').click(function(){ tuts.hide(); $('.pntut.active').show(); $('.devCards').removeClass('active'); $(this).addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('.smstut.active').show(); } } </script>{% endraw %}