const options = {
method: 'POST',
headers: {accept: 'application/json', 'content-type': 'application/json'},
body: JSON.stringify({senderName: 'Cequens', messageType: 'text', shortURL: false})
};
fetch('https://apis.cequens.com/sms/v1/messages', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
require 'uri'
require 'net/http'
url = URI("https://apis.cequens.com/sms/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"senderName\":\"Cequens\",\"messageType\":\"text\",\"shortURL\":false}"
response = http.request(request)
puts response.read_body
request('POST', 'https://apis.cequens.com/sms/v1/messages', [
'body' => '{"senderName":"Cequens","messageType":"text","shortURL":false}',
'headers' => [
'accept' => 'application/json',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
import requests
url = "https://apis.cequens.com/sms/v1/messages"
payload = {
"senderName": "Cequens",
"messageType": "text",
"shortURL": False
}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
using RestSharp;
var options = new RestClientOptions("https://apis.cequens.com/sms/v1/messages");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddJsonBody("{\"senderName\":\"Cequens\",\"messageType\":\"text\",\"shortURL\":false}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"senderName\":\"Cequens\",\"messageType\":\"text\",\"shortURL\":false}");
Request request = new Request.Builder()
.url("https://apis.cequens.com/sms/v1/messages")
.post(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apis.cequens.com/sms/v1/messages"
payload := strings.NewReader("{\"senderName\":\"Cequens\",\"messageType\":\"text\",\"shortURL\":false}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("accept", "application/json")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}