var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic api_key");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"phone": 380632132121,
"sender": "InfoItd",
"text": "This is messages DecisionTelecom",
"validity_period": 300
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("web.it-decision.com/v1/api/send-sms", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("web.it-decision.com")
payload = json.dumps({
"phone": 380632132121,
"sender": "InfoItd",
"text": "This is messages DecisionTelecom",
"validity_period": 300
})
headers = {
'Authorization': 'Basic api_key',
'Content-Type': 'application/json'
}
conn.request("POST", "/v1/api/send-sms", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("web.it-decision.com/v1/api/send-sms");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic api_key");
request.AddHeader("Content-Type", "application/json");
var body = @"{""phone"":380632132121, ""sender"":""InfoItd"", ""text"":""This is messages DecisionTelecom"", ""validity_period"":300}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{"phone":380632132121,"sender":"InfoItd","text":"This is messages DecisionTelecom","validity_period":300}");
Request request = new Request.Builder()
.url("web.it-decision.com/v1/api/send-sms")
.method("POST", body)
.addHeader("Authorization", "Basic api_key")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'web.it-decision.com/v1/api/send-sms',
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 =>'{"phone":380632132121,"sender":"InfoItd","text":"This is messages DecisionTelecom","validity_period":300}',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic api_key',
'Content-Type: application/json',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var axios = require('axios');
var data = JSON.stringify({
"phone": 380632132121,
"sender": "InfoItd",
"text": "This is messages DecisionTelecom",
"validity_period": 300
});
var config = {
method: 'post',
url: 'web.it-decision.com/v1/api/send-sms',
headers: {
'Authorization': 'Basic api_key',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
})
require "uri"
require "json"
require "net/http"
url = URI("web.it-decision.com/v1/api/send-sms")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Basic api_key"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"phone": 380632132121,
"sender": "InfoItd",
"text": "This is messages DecisionTelecom",
"validity_period": 300
})
response = http.request(request)
puts response.read_body
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "web.it-decision.com/v1/api/send-sms"
method := "POST"
payload := strings.NewReader(`{"phone":380632132121,"sender":"InfoItd","text":"This is messages DecisionTelecom","validity_period":300}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Basic api_key")
req.Header.Add("Content-Type", "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))
}