curl --request POST \
--url https://gate.whapi.cloud/contacts \
--header 'accept: application/json' \
--header 'authorization: Bearer Your_Token' \
--header 'content-type: application/json' \
--data '
{
"contacts": [
"447123456789",
"447955033260"
]
}
'
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://gate.whapi.cloud/contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"contacts\":[\"447123456789\",\"447955033260\"]}",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Bearer Your_Token",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://gate.whapi.cloud/contacts"
payload = {
"contacts": [
"447123456789",
"447955033260"
]
}
headers = {
"accept": "application/json",
"authorization": "Bearer Your_Token",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const url = 'https://gate.whapi.cloud/contacts';
const response = await fetch(url, {
method: 'POST',
headers: {
accept: 'application/json',
authorization: 'Bearer Your_Token',
'content-type': 'application/json',
},
body: JSON.stringify({
contacts: ['447123456789', '447955033260'],
}),
});
console.log(await response.text());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"contacts\":[\"447123456789\",\"447955033260\"]}");
Request request = new Request.Builder()
.url("https://gate.whapi.cloud/contacts")
.post(body)
.addHeader("accept", "application/json")
.addHeader("authorization", "Bearer Your_Token")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
using RestSharp;
var options = new RestClientOptions("https://gate.whapi.cloud/contacts");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("Authorization", "Bearer Your_Token");
request.AddHeader("content-type", "application/json");
request.AddJsonBody(new { contacts = new[] { "447123456789", "447955033260" } });
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);