curl --request POST \
--url https://gate.whapi.cloud/groups \
--header 'accept: application/json' \
--header 'authorization: Bearer YOUR_API_TOKEN' \
--header 'content-type: application/json' \
--data '
{
"subject": "New Project Team",
"participants": [
"15056482143",
"15056482144"
]
}
'
// composer require guzzlehttp/guzzle
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://gate.whapi.cloud/groups', [
'body' => '{"subject":"New Project Team","participants":["15056482143","15056482144"]}',
'headers' => [
'accept' => 'application/json',
'authorization' => 'Bearer YOUR_API_TOKEN',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
# python -m pip install requests
import requests
url = "https://gate.whapi.cloud/groups"
payload = {
"subject": "New Project Team",
"participants": ["15056482143", "15056482144"]
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer YOUR_API_TOKEN"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
// npm install axios --save
import axios from 'axios';
const options = {
method: 'POST',
url: 'https://gate.whapi.cloud/groups',
headers: {
accept: 'application/json',
'content-type': 'application/json',
authorization: 'Bearer YOUR_API_TOKEN'
},
data: {
subject: 'New Project Team',
participants: ['15056482143', '15056482144']
}
};
axios.request(options)
.then(res => console.log(res.data))
.catch(err => console.error(err));
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"subject\":\"New Project Team\",\"participants\":[\"15056482143\",\"15056482144\"]}");
Request request = new Request.Builder()
.url("https://gate.whapi.cloud/groups")
.post(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.addHeader("authorization", "Bearer YOUR_API_TOKEN")
.build();
Response response = client.newCall(request).execute();
using RestSharp;
var options = new RestClientOptions("https://gate.whapi.cloud/groups");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Bearer YOUR_API_TOKEN");
request.AddJsonBody("{\"subject\":\"New Project Team\",\"participants\":[\"15056482143\",\"15056482144\"]}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);