POST
/v1/smsSend SMS
Send a text message to one or more numbers.
| numbers | international format without zeros (9665xxxxxxxx), comma-separated |
| message | the text to send |
Errors
- 400invalid_requestbad number or field
- 401unauthorizedbad or disabled key
- 402no_balancenot enough credit
- 429rate_limitedtoo many requests
- 502send_failedcouldn't be sent
Request
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://sms.gccksa.com/v1/sms");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer xxxx");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\"numbers\": \"xxxx,xxxx\", \"message\": \"xxxx\"}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sms.gccksa.com/v1/sms");
request.Headers.Add("Authorization", "Bearer xxxx");
var content = new StringContent("{\"numbers\": \"xxxx,xxxx\", \"message\": \"xxxx\"}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var options = new RestClientOptions("https://sms.gccksa.com")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/v1/sms", Method.Post);
request.AddHeader("Authorization", "Bearer xxxx");
request.AddHeader("Content-Type", "application/json");
var body = @"{""numbers"": ""xxxx,xxxx"", ""message"": ""xxxx""}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);curl --location 'https://sms.gccksa.com/v1/sms' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data '{"numbers": "xxxx,xxxx", "message": "xxxx"}'var headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json'
};
var data = json.encode({
"numbers": "xxxx,xxxx",
"message": "xxxx"
});
var dio = Dio();
var response = await dio.request(
'https://sms.gccksa.com/v1/sms',
options: Options(
method: 'POST',
headers: headers,
),
data: data,
);
if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}var headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://sms.gccksa.com/v1/sms'));
request.body = json.encode({
"numbers": "xxxx,xxxx",
"message": "xxxx"
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sms.gccksa.com/v1/sms"
method := "POST"
payload := strings.NewReader(`{"numbers": "xxxx,xxxx", "message": "xxxx"}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer xxxx")
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 := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}POST /v1/sms HTTP/1.1
Host: sms.gccksa.com
Authorization: Bearer xxxx
Content-Type: application/json
Content-Length: 43
{"numbers": "xxxx,xxxx", "message": "xxxx"}OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"numbers\": \"xxxx,xxxx\", \"message\": \"xxxx\"}");
Request request = new Request.Builder()
.url("https://sms.gccksa.com/v1/sms")
.method("POST", body)
.addHeader("Authorization", "Bearer xxxx")
.addHeader("Content-Type", "application/json")
.addHeader("Content-Length", "")
.build();
Response response = client.newCall(request).execute();Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://sms.gccksa.com/v1/sms")
.header("Authorization", "Bearer xxxx")
.header("Content-Type", "application/json")
.header("Content-Length", "")
.body("{\"numbers\": \"xxxx,xxxx\", \"message\": \"xxxx\"}")
.asString();
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer xxxx");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Content-Length", "");
const raw = JSON.stringify({
"numbers": "xxxx,xxxx",
"message": "xxxx"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://sms.gccksa.com/v1/sms", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));var settings = {
"url": "https://sms.gccksa.com/v1/sms",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer xxxx",
"Content-Type": "application/json",
"Content-Length": ""
},
"data": JSON.stringify({
"numbers": "xxxx,xxxx",
"message": "xxxx"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});// WARNING: For POST requests, body is set to null by browsers.
var data = JSON.stringify({
"numbers": "xxxx,xxxx",
"message": "xxxx"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://sms.gccksa.com/v1/sms");
xhr.setRequestHeader("Authorization", "Bearer xxxx");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Content-Length", "");
xhr.send(data);val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{\"numbers\": \"xxxx,xxxx\", \"message\": \"xxxx\"}".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://sms.gccksa.com/v1/sms")
.post(body)
.addHeader("Authorization", "Bearer xxxx")
.addHeader("Content-Type", "application/json")
.addHeader("Content-Length", "")
.build()
val response = client.newCall(request).execute()const axios = require('axios');
let data = JSON.stringify({
"numbers": "xxxx,xxxx",
"message": "xxxx"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sms.gccksa.com/v1/sms',
headers: {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'sms.gccksa.com',
'path': '/v1/sms',
'headers': {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"numbers": "xxxx,xxxx",
"message": "xxxx"
});
req.write(postData);
req.end();var request = require('request');
var options = {
'method': 'POST',
'url': 'https://sms.gccksa.com/v1/sms',
'headers': {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
body: JSON.stringify({
"numbers": "xxxx,xxxx",
"message": "xxxx"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var unirest = require('unirest');
var req = unirest('POST', 'https://sms.gccksa.com/v1/sms')
.headers({
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
})
.send(JSON.stringify({
"numbers": "xxxx,xxxx",
"message": "xxxx"
}))
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sms.gccksa.com/v1/sms"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"Bearer xxxx",
@"Content-Type": @"application/json",
@"Content-Length": @""
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\"numbers\": \"xxxx,xxxx\", \"message\": \"xxxx\"}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);open Lwt
open Cohttp
open Cohttp_lwt_unix
let postData = ref "{\"numbers\": \"xxxx,xxxx\", \"message\": \"xxxx\"}";;
let reqBody =
let uri = Uri.of_string "https://sms.gccksa.com/v1/sms" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer xxxx"
|> fun h -> Header.add h "Content-Type" "application/json"
|> fun h -> Header.add h "Content-Length" ""
in
let body = Cohttp_lwt.Body.of_string !postData in
Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sms.gccksa.com/v1/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 =>'{"numbers": "xxxx,xxxx", "message": "xxxx"}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer xxxx',
'Content-Type: application/json',
'Content-Length: '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
$client = new Client();
$headers = [
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => '43'
];
$body = '{
"numbers": "xxxx,xxxx",
"message": "xxxx"
}';
$request = new Request('POST', 'https://sms.gccksa.com/v1/sms', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sms.gccksa.com/v1/sms');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => ''
));
$request->setBody('{"numbers": "xxxx,xxxx", "message": "xxxx"}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://sms.gccksa.com/v1/sms');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{"numbers": "xxxx,xxxx", "message": "xxxx"}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => ''
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
postman request POST 'https://sms.gccksa.com/v1/sms' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--header 'Content-Length: ' \
--body '{"numbers": "xxxx,xxxx", "message": "xxxx"}'$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer xxxx")
$headers.Add("Content-Type", "application/json")
$headers.Add("Content-Length", "")
$body = @"
{`"numbers`": `"xxxx,xxxx`", `"message`": `"xxxx`"}
"@
$response = Invoke-RestMethod 'https://sms.gccksa.com/v1/sms' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Jsonimport http.client
import json
conn = http.client.HTTPSConnection("sms.gccksa.com")
payload = json.dumps({
"numbers": "xxxx,xxxx",
"message": "xxxx"
})
headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
}
conn.request("POST", "/v1/sms", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))import requests
import json
url = "https://sms.gccksa.com/v1/sms"
payload = json.dumps({
"numbers": "xxxx,xxxx",
"message": "xxxx"
})
headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
library(httr)
headers = c(
'Authorization' = 'Bearer xxxx',
'Content-Type' = 'application/json',
'Content-Length' = '43'
)
body = '{
"numbers": "xxxx,xxxx",
"message": "xxxx"
}';
res <- VERB("POST", url = "https://sms.gccksa.com/v1/sms", body = body, add_headers(headers))
cat(content(res, 'text'))library(RCurl)
headers = c(
"Authorization" = "Bearer xxxx",
"Content-Type" = "application/json",
"Content-Length" = "43"
)
params = "{
\"numbers\": \"xxxx,xxxx\",
\"message\": \"xxxx\"
}"
res <- postForm("https://sms.gccksa.com/v1/sms", .opts=list(postfields = params, httpheader = headers, followlocation = TRUE), style = "httppost")
cat(res)require "uri"
require "json"
require "net/http"
url = URI("https://sms.gccksa.com/v1/sms")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer xxxx"
request["Content-Type"] = "application/json"
request["Content-Length"] = ""
request.body = JSON.dump({
"numbers": "xxxx,xxxx",
"message": "xxxx"
})
response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Authorization", "Bearer xxxx".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
headers.insert("Content-Length", "".parse()?);
let data = r#"{
"numbers": "xxxx,xxxx",
"message": "xxxx"
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://sms.gccksa.com/v1/sms")
.headers(headers)
.json(&json);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}printf '{"numbers": "xxxx,xxxx", "message": "xxxx"}'| http --follow --timeout 3600 POST 'https://sms.gccksa.com/v1/sms' \
Authorization:'Bearer xxxx' \
Content-Type:'application/json' \
Content-Length:wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--header 'Content-Length: ' \
--body-data '{"numbers": "xxxx,xxxx", "message": "xxxx"}' \
'https://sms.gccksa.com/v1/sms'let parameters = "{\"numbers\": \"xxxx,xxxx\", \"message\": \"xxxx\"}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://sms.gccksa.com/v1/sms")!,timeoutInterval: Double.infinity)
request.addValue("Bearer xxxx", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("", forHTTPHeaderField: "Content-Length")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
200 accepted
{
"status": "accepted",
"recipients": 2,
"credits": 3,
"id": "xxxx"
}POST
/v1/otp/sendSend OTP
We send an OTP to the number and return a request id to verify it against.
| number | international format without zeros (9665xxxxxxxx) |
| lang | optional, en or ar (default en) |
Errors
- 400invalid_requestbad number
- 401unauthorizedbad or disabled key
- 402no_balancenot enough credit
- 429rate_limitedtoo many requests
- 502send_failedcouldn't be sent
Request
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://sms.gccksa.com/v1/otp/send");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer xxxx");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\"number\": \"xxxx\", \"lang\": \"en\"}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sms.gccksa.com/v1/otp/send");
request.Headers.Add("Authorization", "Bearer xxxx");
var content = new StringContent("{\"number\": \"xxxx\", \"lang\": \"en\"}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var options = new RestClientOptions("https://sms.gccksa.com")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/v1/otp/send", Method.Post);
request.AddHeader("Authorization", "Bearer xxxx");
request.AddHeader("Content-Type", "application/json");
var body = @"{""number"": ""xxxx"", ""lang"": ""en""}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);curl --location 'https://sms.gccksa.com/v1/otp/send' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data '{"number": "xxxx", "lang": "en"}'var headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json'
};
var data = json.encode({
"number": "xxxx",
"lang": "en"
});
var dio = Dio();
var response = await dio.request(
'https://sms.gccksa.com/v1/otp/send',
options: Options(
method: 'POST',
headers: headers,
),
data: data,
);
if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}var headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://sms.gccksa.com/v1/otp/send'));
request.body = json.encode({
"number": "xxxx",
"lang": "en"
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sms.gccksa.com/v1/otp/send"
method := "POST"
payload := strings.NewReader(`{"number": "xxxx", "lang": "en"}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer xxxx")
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 := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}POST /v1/otp/send HTTP/1.1
Host: sms.gccksa.com
Authorization: Bearer xxxx
Content-Type: application/json
Content-Length: 32
{"number": "xxxx", "lang": "en"}OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"number\": \"xxxx\", \"lang\": \"en\"}");
Request request = new Request.Builder()
.url("https://sms.gccksa.com/v1/otp/send")
.method("POST", body)
.addHeader("Authorization", "Bearer xxxx")
.addHeader("Content-Type", "application/json")
.addHeader("Content-Length", "")
.build();
Response response = client.newCall(request).execute();Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://sms.gccksa.com/v1/otp/send")
.header("Authorization", "Bearer xxxx")
.header("Content-Type", "application/json")
.header("Content-Length", "")
.body("{\"number\": \"xxxx\", \"lang\": \"en\"}")
.asString();
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer xxxx");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Content-Length", "");
const raw = JSON.stringify({
"number": "xxxx",
"lang": "en"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://sms.gccksa.com/v1/otp/send", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));var settings = {
"url": "https://sms.gccksa.com/v1/otp/send",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer xxxx",
"Content-Type": "application/json",
"Content-Length": ""
},
"data": JSON.stringify({
"number": "xxxx",
"lang": "en"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});// WARNING: For POST requests, body is set to null by browsers.
var data = JSON.stringify({
"number": "xxxx",
"lang": "en"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://sms.gccksa.com/v1/otp/send");
xhr.setRequestHeader("Authorization", "Bearer xxxx");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Content-Length", "");
xhr.send(data);val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{\"number\": \"xxxx\", \"lang\": \"en\"}".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://sms.gccksa.com/v1/otp/send")
.post(body)
.addHeader("Authorization", "Bearer xxxx")
.addHeader("Content-Type", "application/json")
.addHeader("Content-Length", "")
.build()
val response = client.newCall(request).execute()const axios = require('axios');
let data = JSON.stringify({
"number": "xxxx",
"lang": "en"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sms.gccksa.com/v1/otp/send',
headers: {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'sms.gccksa.com',
'path': '/v1/otp/send',
'headers': {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"number": "xxxx",
"lang": "en"
});
req.write(postData);
req.end();var request = require('request');
var options = {
'method': 'POST',
'url': 'https://sms.gccksa.com/v1/otp/send',
'headers': {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
body: JSON.stringify({
"number": "xxxx",
"lang": "en"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var unirest = require('unirest');
var req = unirest('POST', 'https://sms.gccksa.com/v1/otp/send')
.headers({
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
})
.send(JSON.stringify({
"number": "xxxx",
"lang": "en"
}))
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sms.gccksa.com/v1/otp/send"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"Bearer xxxx",
@"Content-Type": @"application/json",
@"Content-Length": @""
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\"number\": \"xxxx\", \"lang\": \"en\"}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);open Lwt
open Cohttp
open Cohttp_lwt_unix
let postData = ref "{\"number\": \"xxxx\", \"lang\": \"en\"}";;
let reqBody =
let uri = Uri.of_string "https://sms.gccksa.com/v1/otp/send" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer xxxx"
|> fun h -> Header.add h "Content-Type" "application/json"
|> fun h -> Header.add h "Content-Length" ""
in
let body = Cohttp_lwt.Body.of_string !postData in
Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sms.gccksa.com/v1/otp/send',
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 =>'{"number": "xxxx", "lang": "en"}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer xxxx',
'Content-Type: application/json',
'Content-Length: '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
$client = new Client();
$headers = [
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => '32'
];
$body = '{
"number": "xxxx",
"lang": "en"
}';
$request = new Request('POST', 'https://sms.gccksa.com/v1/otp/send', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sms.gccksa.com/v1/otp/send');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => ''
));
$request->setBody('{"number": "xxxx", "lang": "en"}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://sms.gccksa.com/v1/otp/send');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{"number": "xxxx", "lang": "en"}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => ''
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
postman request POST 'https://sms.gccksa.com/v1/otp/send' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--header 'Content-Length: ' \
--body '{"number": "xxxx", "lang": "en"}'$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer xxxx")
$headers.Add("Content-Type", "application/json")
$headers.Add("Content-Length", "")
$body = @"
{`"number`": `"xxxx`", `"lang`": `"en`"}
"@
$response = Invoke-RestMethod 'https://sms.gccksa.com/v1/otp/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Jsonimport http.client
import json
conn = http.client.HTTPSConnection("sms.gccksa.com")
payload = json.dumps({
"number": "xxxx",
"lang": "en"
})
headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
}
conn.request("POST", "/v1/otp/send", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))import requests
import json
url = "https://sms.gccksa.com/v1/otp/send"
payload = json.dumps({
"number": "xxxx",
"lang": "en"
})
headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
library(httr)
headers = c(
'Authorization' = 'Bearer xxxx',
'Content-Type' = 'application/json',
'Content-Length' = '32'
)
body = '{
"number": "xxxx",
"lang": "en"
}';
res <- VERB("POST", url = "https://sms.gccksa.com/v1/otp/send", body = body, add_headers(headers))
cat(content(res, 'text'))library(RCurl)
headers = c(
"Authorization" = "Bearer xxxx",
"Content-Type" = "application/json",
"Content-Length" = "32"
)
params = "{
\"number\": \"xxxx\",
\"lang\": \"en\"
}"
res <- postForm("https://sms.gccksa.com/v1/otp/send", .opts=list(postfields = params, httpheader = headers, followlocation = TRUE), style = "httppost")
cat(res)require "uri"
require "json"
require "net/http"
url = URI("https://sms.gccksa.com/v1/otp/send")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer xxxx"
request["Content-Type"] = "application/json"
request["Content-Length"] = ""
request.body = JSON.dump({
"number": "xxxx",
"lang": "en"
})
response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Authorization", "Bearer xxxx".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
headers.insert("Content-Length", "".parse()?);
let data = r#"{
"number": "xxxx",
"lang": "en"
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://sms.gccksa.com/v1/otp/send")
.headers(headers)
.json(&json);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}printf '{"number": "xxxx", "lang": "en"}'| http --follow --timeout 3600 POST 'https://sms.gccksa.com/v1/otp/send' \
Authorization:'Bearer xxxx' \
Content-Type:'application/json' \
Content-Length:wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--header 'Content-Length: ' \
--body-data '{"number": "xxxx", "lang": "en"}' \
'https://sms.gccksa.com/v1/otp/send'let parameters = "{\"number\": \"xxxx\", \"lang\": \"en\"}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://sms.gccksa.com/v1/otp/send")!,timeoutInterval: Double.infinity)
request.addValue("Bearer xxxx", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("", forHTTPHeaderField: "Content-Length")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
200
{ "status": "sent", "credits": 1, "id": "xxxx" }POST
/v1/otp/verifyVerify OTP
Verify that the OTP matches the request id from the Send OTP request.
Errors
- 400invalid_requestmissing id or code
- 401unauthorizedbad key, or wrong code
- 402no_balancenot enough credit
- 404not_foundunknown id
- 429rate_limitedtoo many tries
Request
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://sms.gccksa.com/v1/otp/verify");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer xxxx");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\"id\": \"xxxx\", \"code\": \"xxxx\"}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sms.gccksa.com/v1/otp/verify");
request.Headers.Add("Authorization", "Bearer xxxx");
var content = new StringContent("{\"id\": \"xxxx\", \"code\": \"xxxx\"}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var options = new RestClientOptions("https://sms.gccksa.com")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/v1/otp/verify", Method.Post);
request.AddHeader("Authorization", "Bearer xxxx");
request.AddHeader("Content-Type", "application/json");
var body = @"{""id"": ""xxxx"", ""code"": ""xxxx""}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);curl --location 'https://sms.gccksa.com/v1/otp/verify' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data '{"id": "xxxx", "code": "xxxx"}'var headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json'
};
var data = json.encode({
"id": "xxxx",
"code": "xxxx"
});
var dio = Dio();
var response = await dio.request(
'https://sms.gccksa.com/v1/otp/verify',
options: Options(
method: 'POST',
headers: headers,
),
data: data,
);
if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}var headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://sms.gccksa.com/v1/otp/verify'));
request.body = json.encode({
"id": "xxxx",
"code": "xxxx"
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sms.gccksa.com/v1/otp/verify"
method := "POST"
payload := strings.NewReader(`{"id": "xxxx", "code": "xxxx"}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer xxxx")
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 := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}POST /v1/otp/verify HTTP/1.1
Host: sms.gccksa.com
Authorization: Bearer xxxx
Content-Type: application/json
Content-Length: 30
{"id": "xxxx", "code": "xxxx"}OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"id\": \"xxxx\", \"code\": \"xxxx\"}");
Request request = new Request.Builder()
.url("https://sms.gccksa.com/v1/otp/verify")
.method("POST", body)
.addHeader("Authorization", "Bearer xxxx")
.addHeader("Content-Type", "application/json")
.addHeader("Content-Length", "")
.build();
Response response = client.newCall(request).execute();Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://sms.gccksa.com/v1/otp/verify")
.header("Authorization", "Bearer xxxx")
.header("Content-Type", "application/json")
.header("Content-Length", "")
.body("{\"id\": \"xxxx\", \"code\": \"xxxx\"}")
.asString();
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer xxxx");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Content-Length", "");
const raw = JSON.stringify({
"id": "xxxx",
"code": "xxxx"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://sms.gccksa.com/v1/otp/verify", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));var settings = {
"url": "https://sms.gccksa.com/v1/otp/verify",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer xxxx",
"Content-Type": "application/json",
"Content-Length": ""
},
"data": JSON.stringify({
"id": "xxxx",
"code": "xxxx"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});// WARNING: For POST requests, body is set to null by browsers.
var data = JSON.stringify({
"id": "xxxx",
"code": "xxxx"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://sms.gccksa.com/v1/otp/verify");
xhr.setRequestHeader("Authorization", "Bearer xxxx");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Content-Length", "");
xhr.send(data);val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{\"id\": \"xxxx\", \"code\": \"xxxx\"}".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://sms.gccksa.com/v1/otp/verify")
.post(body)
.addHeader("Authorization", "Bearer xxxx")
.addHeader("Content-Type", "application/json")
.addHeader("Content-Length", "")
.build()
val response = client.newCall(request).execute()const axios = require('axios');
let data = JSON.stringify({
"id": "xxxx",
"code": "xxxx"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sms.gccksa.com/v1/otp/verify',
headers: {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'sms.gccksa.com',
'path': '/v1/otp/verify',
'headers': {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"id": "xxxx",
"code": "xxxx"
});
req.write(postData);
req.end();var request = require('request');
var options = {
'method': 'POST',
'url': 'https://sms.gccksa.com/v1/otp/verify',
'headers': {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
body: JSON.stringify({
"id": "xxxx",
"code": "xxxx"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var unirest = require('unirest');
var req = unirest('POST', 'https://sms.gccksa.com/v1/otp/verify')
.headers({
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
})
.send(JSON.stringify({
"id": "xxxx",
"code": "xxxx"
}))
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sms.gccksa.com/v1/otp/verify"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"Bearer xxxx",
@"Content-Type": @"application/json",
@"Content-Length": @""
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\"id\": \"xxxx\", \"code\": \"xxxx\"}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);open Lwt
open Cohttp
open Cohttp_lwt_unix
let postData = ref "{\"id\": \"xxxx\", \"code\": \"xxxx\"}";;
let reqBody =
let uri = Uri.of_string "https://sms.gccksa.com/v1/otp/verify" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer xxxx"
|> fun h -> Header.add h "Content-Type" "application/json"
|> fun h -> Header.add h "Content-Length" ""
in
let body = Cohttp_lwt.Body.of_string !postData in
Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sms.gccksa.com/v1/otp/verify',
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 =>'{"id": "xxxx", "code": "xxxx"}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer xxxx',
'Content-Type: application/json',
'Content-Length: '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
$client = new Client();
$headers = [
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => '30'
];
$body = '{
"id": "xxxx",
"code": "xxxx"
}';
$request = new Request('POST', 'https://sms.gccksa.com/v1/otp/verify', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sms.gccksa.com/v1/otp/verify');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => ''
));
$request->setBody('{"id": "xxxx", "code": "xxxx"}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://sms.gccksa.com/v1/otp/verify');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{"id": "xxxx", "code": "xxxx"}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => ''
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
postman request POST 'https://sms.gccksa.com/v1/otp/verify' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--header 'Content-Length: ' \
--body '{"id": "xxxx", "code": "xxxx"}'$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer xxxx")
$headers.Add("Content-Type", "application/json")
$headers.Add("Content-Length", "")
$body = @"
{`"id`": `"xxxx`", `"code`": `"xxxx`"}
"@
$response = Invoke-RestMethod 'https://sms.gccksa.com/v1/otp/verify' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Jsonimport http.client
import json
conn = http.client.HTTPSConnection("sms.gccksa.com")
payload = json.dumps({
"id": "xxxx",
"code": "xxxx"
})
headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
}
conn.request("POST", "/v1/otp/verify", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))import requests
import json
url = "https://sms.gccksa.com/v1/otp/verify"
payload = json.dumps({
"id": "xxxx",
"code": "xxxx"
})
headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
library(httr)
headers = c(
'Authorization' = 'Bearer xxxx',
'Content-Type' = 'application/json',
'Content-Length' = '30'
)
body = '{
"id": "xxxx",
"code": "xxxx"
}';
res <- VERB("POST", url = "https://sms.gccksa.com/v1/otp/verify", body = body, add_headers(headers))
cat(content(res, 'text'))library(RCurl)
headers = c(
"Authorization" = "Bearer xxxx",
"Content-Type" = "application/json",
"Content-Length" = "30"
)
params = "{
\"id\": \"xxxx\",
\"code\": \"xxxx\"
}"
res <- postForm("https://sms.gccksa.com/v1/otp/verify", .opts=list(postfields = params, httpheader = headers, followlocation = TRUE), style = "httppost")
cat(res)require "uri"
require "json"
require "net/http"
url = URI("https://sms.gccksa.com/v1/otp/verify")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer xxxx"
request["Content-Type"] = "application/json"
request["Content-Length"] = ""
request.body = JSON.dump({
"id": "xxxx",
"code": "xxxx"
})
response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Authorization", "Bearer xxxx".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
headers.insert("Content-Length", "".parse()?);
let data = r#"{
"id": "xxxx",
"code": "xxxx"
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://sms.gccksa.com/v1/otp/verify")
.headers(headers)
.json(&json);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}printf '{"id": "xxxx", "code": "xxxx"}'| http --follow --timeout 3600 POST 'https://sms.gccksa.com/v1/otp/verify' \
Authorization:'Bearer xxxx' \
Content-Type:'application/json' \
Content-Length:wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--header 'Content-Length: ' \
--body-data '{"id": "xxxx", "code": "xxxx"}' \
'https://sms.gccksa.com/v1/otp/verify'let parameters = "{\"id\": \"xxxx\", \"code\": \"xxxx\"}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://sms.gccksa.com/v1/otp/verify")!,timeoutInterval: Double.infinity)
request.addValue("Bearer xxxx", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("", forHTTPHeaderField: "Content-Length")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
200
{ "verified": true }GET
/v1/balanceCheck balance
Your remaining credit balance and how much you have used this month.
Errors
- 401unauthorizedbad or disabled key
Request
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://sms.gccksa.com/v1/balance");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer xxxx");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://sms.gccksa.com/v1/balance");
request.Headers.Add("Authorization", "Bearer xxxx");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var options = new RestClientOptions("https://sms.gccksa.com")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/v1/balance", Method.Get);
request.AddHeader("Authorization", "Bearer xxxx");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);curl --location 'https://sms.gccksa.com/v1/balance' \
--header 'Authorization: Bearer xxxx'var headers = {
'Authorization': 'Bearer xxxx'
};
var dio = Dio();
var response = await dio.request(
'https://sms.gccksa.com/v1/balance',
options: Options(
method: 'GET',
headers: headers,
),
);
if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}var headers = {
'Authorization': 'Bearer xxxx'
};
var request = http.Request('GET', Uri.parse('https://sms.gccksa.com/v1/balance'));
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sms.gccksa.com/v1/balance"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer xxxx")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}GET /v1/balance HTTP/1.1
Host: sms.gccksa.com
Authorization: Bearer xxxxOkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://sms.gccksa.com/v1/balance")
.method("GET", body)
.addHeader("Authorization", "Bearer xxxx")
.build();
Response response = client.newCall(request).execute();Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://sms.gccksa.com/v1/balance")
.header("Authorization", "Bearer xxxx")
.asString();
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer xxxx");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://sms.gccksa.com/v1/balance", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));var settings = {
"url": "https://sms.gccksa.com/v1/balance",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer xxxx"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});// WARNING: For GET requests, body is set to null by browsers.
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://sms.gccksa.com/v1/balance");
xhr.setRequestHeader("Authorization", "Bearer xxxx");
xhr.send();val client = OkHttpClient()
val request = Request.Builder()
.url("https://sms.gccksa.com/v1/balance")
.addHeader("Authorization", "Bearer xxxx")
.build()
val response = client.newCall(request).execute()const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://sms.gccksa.com/v1/balance',
headers: {
'Authorization': 'Bearer xxxx'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': 'sms.gccksa.com',
'path': '/v1/balance',
'headers': {
'Authorization': 'Bearer xxxx'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();var request = require('request');
var options = {
'method': 'GET',
'url': 'https://sms.gccksa.com/v1/balance',
'headers': {
'Authorization': 'Bearer xxxx'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var unirest = require('unirest');
var req = unirest('GET', 'https://sms.gccksa.com/v1/balance')
.headers({
'Authorization': 'Bearer xxxx'
})
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sms.gccksa.com/v1/balance"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"Bearer xxxx"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);open Lwt
open Cohttp
open Cohttp_lwt_unix
let reqBody =
let uri = Uri.of_string "https://sms.gccksa.com/v1/balance" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer xxxx"
in
Client.call ~headers `GET uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sms.gccksa.com/v1/balance',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer xxxx'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
$client = new Client();
$headers = [
'Authorization' => 'Bearer xxxx'
];
$request = new Request('GET', 'https://sms.gccksa.com/v1/balance', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sms.gccksa.com/v1/balance');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'Bearer xxxx'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://sms.gccksa.com/v1/balance');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'Bearer xxxx'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
postman request 'https://sms.gccksa.com/v1/balance' \
--header 'Authorization: Bearer xxxx'$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer xxxx")
$response = Invoke-RestMethod 'https://sms.gccksa.com/v1/balance' -Method 'GET' -Headers $headers
$response | ConvertTo-Jsonimport http.client
conn = http.client.HTTPSConnection("sms.gccksa.com")
payload = ''
headers = {
'Authorization': 'Bearer xxxx'
}
conn.request("GET", "/v1/balance", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))import requests
url = "https://sms.gccksa.com/v1/balance"
payload = {}
headers = {
'Authorization': 'Bearer xxxx'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
library(httr)
headers = c(
'Authorization' = 'Bearer xxxx'
)
res <- VERB("GET", url = "https://sms.gccksa.com/v1/balance", add_headers(headers))
cat(content(res, 'text'))library(RCurl)
headers = c(
"Authorization" = "Bearer xxxx"
)
res <- getURL("https://sms.gccksa.com/v1/balance", .opts=list(httpheader = headers, followlocation = TRUE))
cat(res)require "uri"
require "net/http"
url = URI("https://sms.gccksa.com/v1/balance")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer xxxx"
response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Authorization", "Bearer xxxx".parse()?);
let request = client.request(reqwest::Method::GET, "https://sms.gccksa.com/v1/balance")
.headers(headers);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}http --follow --timeout 3600 GET 'https://sms.gccksa.com/v1/balance' \
Authorization:'Bearer xxxx'wget --no-check-certificate --quiet \
--method GET \
--timeout=0 \
--header 'Authorization: Bearer xxxx' \
'https://sms.gccksa.com/v1/balance'var request = URLRequest(url: URL(string: "https://sms.gccksa.com/v1/balance")!,timeoutInterval: Double.infinity)
request.addValue("Bearer xxxx", forHTTPHeaderField: "Authorization")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
200
{ "available": 25000, "usedThisMonth": 1200 }POST
/v1/messagesDelivery status
Get the delivery status of each number in a send, using the request id.
Errors
- 400invalid_requestmissing id
- 401unauthorizedbad or disabled key
- 404not_foundunknown id
Request
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://sms.gccksa.com/v1/messages");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer xxxx");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\"id\": \"xxxx\"}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sms.gccksa.com/v1/messages");
request.Headers.Add("Authorization", "Bearer xxxx");
var content = new StringContent("{\"id\": \"xxxx\"}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var options = new RestClientOptions("https://sms.gccksa.com")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/v1/messages", Method.Post);
request.AddHeader("Authorization", "Bearer xxxx");
request.AddHeader("Content-Type", "application/json");
var body = @"{""id"": ""xxxx""}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);curl --location 'https://sms.gccksa.com/v1/messages' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data '{"id": "xxxx"}'var headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json'
};
var data = json.encode({
"id": "xxxx"
});
var dio = Dio();
var response = await dio.request(
'https://sms.gccksa.com/v1/messages',
options: Options(
method: 'POST',
headers: headers,
),
data: data,
);
if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}var headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://sms.gccksa.com/v1/messages'));
request.body = json.encode({
"id": "xxxx"
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sms.gccksa.com/v1/messages"
method := "POST"
payload := strings.NewReader(`{"id": "xxxx"}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer xxxx")
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 := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}POST /v1/messages HTTP/1.1
Host: sms.gccksa.com
Authorization: Bearer xxxx
Content-Type: application/json
Content-Length: 14
{"id": "xxxx"}OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"id\": \"xxxx\"}");
Request request = new Request.Builder()
.url("https://sms.gccksa.com/v1/messages")
.method("POST", body)
.addHeader("Authorization", "Bearer xxxx")
.addHeader("Content-Type", "application/json")
.addHeader("Content-Length", "")
.build();
Response response = client.newCall(request).execute();Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://sms.gccksa.com/v1/messages")
.header("Authorization", "Bearer xxxx")
.header("Content-Type", "application/json")
.header("Content-Length", "")
.body("{\"id\": \"xxxx\"}")
.asString();
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer xxxx");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Content-Length", "");
const raw = JSON.stringify({
"id": "xxxx"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://sms.gccksa.com/v1/messages", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));var settings = {
"url": "https://sms.gccksa.com/v1/messages",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer xxxx",
"Content-Type": "application/json",
"Content-Length": ""
},
"data": JSON.stringify({
"id": "xxxx"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});// WARNING: For POST requests, body is set to null by browsers.
var data = JSON.stringify({
"id": "xxxx"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://sms.gccksa.com/v1/messages");
xhr.setRequestHeader("Authorization", "Bearer xxxx");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Content-Length", "");
xhr.send(data);val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{\"id\": \"xxxx\"}".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://sms.gccksa.com/v1/messages")
.post(body)
.addHeader("Authorization", "Bearer xxxx")
.addHeader("Content-Type", "application/json")
.addHeader("Content-Length", "")
.build()
val response = client.newCall(request).execute()const axios = require('axios');
let data = JSON.stringify({
"id": "xxxx"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sms.gccksa.com/v1/messages',
headers: {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'sms.gccksa.com',
'path': '/v1/messages',
'headers': {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"id": "xxxx"
});
req.write(postData);
req.end();var request = require('request');
var options = {
'method': 'POST',
'url': 'https://sms.gccksa.com/v1/messages',
'headers': {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
},
body: JSON.stringify({
"id": "xxxx"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var unirest = require('unirest');
var req = unirest('POST', 'https://sms.gccksa.com/v1/messages')
.headers({
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
})
.send(JSON.stringify({
"id": "xxxx"
}))
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sms.gccksa.com/v1/messages"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"Bearer xxxx",
@"Content-Type": @"application/json",
@"Content-Length": @""
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\"id\": \"xxxx\"}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);open Lwt
open Cohttp
open Cohttp_lwt_unix
let postData = ref "{\"id\": \"xxxx\"}";;
let reqBody =
let uri = Uri.of_string "https://sms.gccksa.com/v1/messages" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer xxxx"
|> fun h -> Header.add h "Content-Type" "application/json"
|> fun h -> Header.add h "Content-Length" ""
in
let body = Cohttp_lwt.Body.of_string !postData in
Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sms.gccksa.com/v1/messages',
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 =>'{"id": "xxxx"}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer xxxx',
'Content-Type: application/json',
'Content-Length: '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
$client = new Client();
$headers = [
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => '14'
];
$body = '{
"id": "xxxx"
}';
$request = new Request('POST', 'https://sms.gccksa.com/v1/messages', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sms.gccksa.com/v1/messages');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => ''
));
$request->setBody('{"id": "xxxx"}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://sms.gccksa.com/v1/messages');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{"id": "xxxx"}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'Bearer xxxx',
'Content-Type' => 'application/json',
'Content-Length' => ''
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
postman request POST 'https://sms.gccksa.com/v1/messages' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--header 'Content-Length: ' \
--body '{"id": "xxxx"}'$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer xxxx")
$headers.Add("Content-Type", "application/json")
$headers.Add("Content-Length", "")
$body = @"
{`"id`": `"xxxx`"}
"@
$response = Invoke-RestMethod 'https://sms.gccksa.com/v1/messages' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Jsonimport http.client
import json
conn = http.client.HTTPSConnection("sms.gccksa.com")
payload = json.dumps({
"id": "xxxx"
})
headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
}
conn.request("POST", "/v1/messages", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))import requests
import json
url = "https://sms.gccksa.com/v1/messages"
payload = json.dumps({
"id": "xxxx"
})
headers = {
'Authorization': 'Bearer xxxx',
'Content-Type': 'application/json',
'Content-Length': ''
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
library(httr)
headers = c(
'Authorization' = 'Bearer xxxx',
'Content-Type' = 'application/json',
'Content-Length' = '14'
)
body = '{
"id": "xxxx"
}';
res <- VERB("POST", url = "https://sms.gccksa.com/v1/messages", body = body, add_headers(headers))
cat(content(res, 'text'))library(RCurl)
headers = c(
"Authorization" = "Bearer xxxx",
"Content-Type" = "application/json",
"Content-Length" = "14"
)
params = "{
\"id\": \"xxxx\"
}"
res <- postForm("https://sms.gccksa.com/v1/messages", .opts=list(postfields = params, httpheader = headers, followlocation = TRUE), style = "httppost")
cat(res)require "uri"
require "json"
require "net/http"
url = URI("https://sms.gccksa.com/v1/messages")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer xxxx"
request["Content-Type"] = "application/json"
request["Content-Length"] = ""
request.body = JSON.dump({
"id": "xxxx"
})
response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Authorization", "Bearer xxxx".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
headers.insert("Content-Length", "".parse()?);
let data = r#"{
"id": "xxxx"
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://sms.gccksa.com/v1/messages")
.headers(headers)
.json(&json);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}printf '{"id": "xxxx"}'| http --follow --timeout 3600 POST 'https://sms.gccksa.com/v1/messages' \
Authorization:'Bearer xxxx' \
Content-Type:'application/json' \
Content-Length:wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--header 'Content-Length: ' \
--body-data '{"id": "xxxx"}' \
'https://sms.gccksa.com/v1/messages'let parameters = "{\"id\": \"xxxx\"}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://sms.gccksa.com/v1/messages")!,timeoutInterval: Double.infinity)
request.addValue("Bearer xxxx", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("", forHTTPHeaderField: "Content-Length")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
200
{
"id": "xxxx",
"messages": [
{ "number": "xxxx", "status": "delivered" },
{ "number": "xxxx", "status": "sent" }
]
}