OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"scenarioKey\":\"AD9E01A5DC7BEE2C2B828D208182A611\",\"bulkId\":\"BULK-ID-123-xyz\",\"destinations\":[{\"messageId\":\"MESSAGE-ID-123-xyz\",\"to\":{\"phoneNumber\":\"41793026727\",\"emailAddress\":\"email@example.com\"}},{\"to\":{\"phoneNumber\":\"41793026731\"}}],\"sms\":{\"text\":\"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.\",\"transliteration\":\"TURKISH\",\"language\":{\"languageCode\":\"TR\"}},\"viber\":{\"text\":\"Or to have fun with Viber text.\"},\"voice\":{\"text\":\"Or make a call and read this text\"},\"email\":{\"text\":\"Finally, send an email.\",\"subject\":\"Email subject\"}}");
Request request = new Request.Builder()
.url("https://{baseUrl}/omni/1/advanced")
.method("POST", body)
.addHeader("Authorization", "{authorization}")
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
Response response = client.newCall(request).execute();
1
2
3
4
5
6
7
8
9
10
11
12
13
var settings = {
"url": "https://{baseUrl}/omni/1/advanced",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "{authorization}",
"Content-Type": "application/json",
"Accept": "application/json"
},
"data": JSON.stringify({
"scenarioKey": "AD9E01A5DC7BEE2C2B828D208182A611",
"bulkId": "BULK-ID-123-xyz",
"destinations": [
{
"messageId": "MESSAGE-ID-123-xyz",
"to": {
"phoneNumber": "41793026727",
"emailAddress": "email@example.com"
}
},
{
"to": {
"phoneNumber": "41793026731"
}
}
],
"sms": {
"text": "Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.",
"transliteration": "TURKISH",
"language": {
"languageCode": "TR"
}
},
"viber": {
"text": "Or to have fun with Viber text."
},
"voice": {
"text": "Or make a call and read this text"
},
"email": {
"text": "Finally, send an email.",
"subject": "Email subject"
}
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var client = new RestClient("https://{baseUrl}/omni/1/advanced");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "{authorization}");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
var body = @"{""scenarioKey"":""AD9E01A5DC7BEE2C2B828D208182A611"",""bulkId"":""BULK-ID-123-xyz"",""destinations"":[{""messageId"":""MESSAGE-ID-123-xyz"",""to"":{""phoneNumber"":""41793026727"",""emailAddress"":""email@example.com""}},{""to"":{""phoneNumber"":""41793026731""}}],""sms"":{""text"":""Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz."",""transliteration"":""TURKISH"",""language"":{""languageCode"":""TR""}},""viber"":{""text"":""Or to have fun with Viber text.""},""voice"":{""text"":""Or make a call and read this text""},""email"":{""text"":""Finally, send an email."",""subject"":""Email subject""}}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
1
2
3
4
5
6
7
8
9
10
11
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
<code>url := "https://%7BbaseUrl%7D/omni/1/advanced" method := "POST" payload := strings.NewReader(`{"scenarioKey":"AD9E01A5DC7BEE2C2B828D208182A611","bulkId":"BULK-ID-123-xyz","destinations":[{"messageId":"MESSAGE-ID-123-xyz","to":{"phoneNumber":"41793026727","emailAddress":"email@example.com"}},{"to":{"phoneNumber":"41793026731"}}],"sms":{"text":"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.","transliteration":"TURKISH","language":{"languageCode":"TR"}},"viber":{"text":"Or to have fun with Viber text."},"voice":{"text":"Or make a call and read this text"},"email":{"text":"Finally, send an email.","subject":"Email subject"}}`) client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("Authorization", "{authorization}") req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body))</code>
}
1
2
3
4
5
6
7
8
9
10
11
import http.client
import json
conn = http.client.HTTPSConnection("{baseUrl}")
payload = json.dumps({
"scenarioKey": "AD9E01A5DC7BEE2C2B828D208182A611",
"bulkId": "BULK-ID-123-xyz",
"destinations": [
{
"messageId": "MESSAGE-ID-123-xyz",
"to": {
"phoneNumber": "41793026727",
"emailAddress": "email@example.com"
}
},
{
"to": {
"phoneNumber": "41793026731"
}
}
],
"sms": {
"text": "Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.",
"transliteration": "TURKISH",
"language": {
"languageCode": "TR"
}
},
"viber": {
"text": "Or to have fun with Viber text."
},
"voice": {
"text": "Or make a call and read this text"
},
"email": {
"text": "Finally, send an email.",
"subject": "Email subject"
}
})
headers = {
'Authorization': '{authorization}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
conn.request("POST", "/omni/1/advanced", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require "uri"
require "json"
require "net/http"
url = URI("https://{baseUrl}/omni/1/advanced")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "{authorization}"
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request.body = JSON.dump({
"scenarioKey": "AD9E01A5DC7BEE2C2B828D208182A611",
"bulkId": "BULK-ID-123-xyz",
"destinations": [
{
"messageId": "MESSAGE-ID-123-xyz",
"to": {
"phoneNumber": "41793026727",
"emailAddress": "email@example.com"
}
},
{
"to": {
"phoneNumber": "41793026731"
}
}
],
"sms": {
"text": "Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.",
"transliteration": "TURKISH",
"language": {
"languageCode": "TR"
}
},
"viber": {
"text": "Or to have fun with Viber text."
},
"voice": {
"text": "Or make a call and read this text"
},
"email": {
"text": "Finally, send an email.",
"subject": "Email subject"
}
})
response = https.request(request)
puts response.read_body
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://%7BbaseUrl%7D/omni/1/advanced',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"scenarioKey":"AD9E01A5DC7BEE2C2B828D208182A611","bulkId":"BULK-ID-123-xyz","destinations":[{"messageId":"MESSAGE-ID-123-xyz","to":{"phoneNumber":"41793026727","emailAddress":"email@example.com"}},{"to":{"phoneNumber":"41793026731"}}],"sms":{"text":"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.","transliteration":"TURKISH","language":{"languageCode":"TR"}},"viber":{"text":"Or to have fun with Viber text."},"voice":{"text":"Or make a call and read this text"},"email":{"text":"Finally, send an email.","subject":"Email subject"}}',
CURLOPT_HTTPHEADER => array(
'Authorization: {authorization}',
'Content-Type: application/json',
'Accept: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22