curl -X POST \\
"${BASE_URL}/query" \\
-H "Authorization: Bearer ${API_TOKEN}" \\
-H "Content-Type: application/json" \\
-d '"value"'
const payload = "value";
const url = "${BASE_URL}/query";
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": "Bearer ${API_TOKEN}",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(await response.json());
const payload = "value";
const url = "${BASE_URL}/query";
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": "Bearer ${API_TOKEN}",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
} as RequestInit);
console.log(await response.json());
const payload = "value";
const response = await axios({
method: "post",
url: "${BASE_URL}/query",
headers: {
Authorization: "Bearer ${API_TOKEN}",
"Content-Type": "application/json",
},
data: payload,
});
console.log(response.data);
const payload = "value";
const response: AxiosResponse = await axios({
method: "post",
url: "${BASE_URL}/query",
headers: {
Authorization: "Bearer ${API_TOKEN}",
"Content-Type": "application/json",
},
data: payload,
});
console.log(response.data);
import { request } from "undici";
const bodyData = "value";
const { body } = await request("${BASE_URL}/query", {
method: "POST",
headers: {
Authorization: "Bearer ${API_TOKEN}",
"Content-Type": "application/json",
},
body: JSON.stringify(bodyData),
});
console.log(await body.json());
import requests
payload = "value"
response = requests.request( \
"POST", \
"${BASE_URL}/query", \
headers={"Authorization": "Bearer ${API_TOKEN}"}, \
json=payload,
)
print(response.json())
import httpx
payload = "value"
with httpx.Client() as client:
response = client.request( \
"POST", \
"${BASE_URL}/query", \
headers={"Authorization": "Bearer ${API_TOKEN}"}, \
json=payload,
)
print(response.json())
payload := bytes.NewBuffer([]byte(`"value"`))
req, err := http.NewRequest("POST", "${BASE_URL}/query", payload)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer ${API_TOKEN}")
if payload != http.NoBody {
req.Header.Set("Content-Type", "application/json")
}
res, err := (&http.Client{}).Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
require "json"
require "net/http"
payload = "value"
uri = URI("${BASE_URL}/query")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer ${API_TOKEN}"
request["Content-Type"] = "application/json"
request.body = payload.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") { |http| \
http.request(request) \
}
puts response.body
<?php
use GuzzleHttp\Client;
$payload = "value";
$client = new Client();
$response = $client->request("POST", "${BASE_URL}/query", [
'headers' => [
'Authorization' => 'Bearer ${API_TOKEN}',
],
'json' => $payload,
]);
echo $response->getBody();
using System.Net.Http;
using System.Text;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "${BASE_URL}/query");
request.Headers.Add("Authorization", "Bearer ${API_TOKEN}");
request.Content = new StringContent("\"value\"", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());