curl --request POST \
--url https://gate.whapi.cloud/stories/send/media \
--header 'accept: application/json' \
--header 'authorization: Bearer Your_Token' \
--header 'content-type: application/json' \
--data '
{
"media": "https://example.com/product.jpg"
}
'
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://gate.whapi.cloud/stories/send/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"media\":\"https://example.com/product.jpg\"}",
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/stories/send/media"
payload = {
"media": "https://example.com/product.jpg"
}
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/stories/send/media';
const response = await fetch(url, {
method: 'POST',
headers: {
accept: 'application/json',
authorization: 'Bearer Your_Token',
'content-type': 'application/json',
},
body: JSON.stringify({
media: 'https://example.com/product.jpg',
}),
});
console.log(await response.text());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"media\":\"https://example.com/product.jpg\"}");
Request request = new Request.Builder()
.url("https://gate.whapi.cloud/stories/send/media")
.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/stories/send/media");
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.AddStringBody("{\"media\":\"https://example.com/product.jpg\"}", DataFormat.Json);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"media":"https://example.com/product.jpg"}`)
req, _ := http.NewRequest("POST", "https://gate.whapi.cloud/stories/send/media", body)
req.Header.Set("accept", "application/json")
req.Header.Set("authorization", "Bearer Your_Token")
req.Header.Set("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}