const res = await fetch("https://leafpage.cc/api/setlatest", {
method: "POST",
headers: {
"Authorization": "Bearer lp_…",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "quarterly-report",
"code": "a1b2c3d4e5f6g7h8"
}),
});
const data = await res.json();
$ch = curl_init("https://leafpage.cc/api/setlatest");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer lp_…", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"name":"quarterly-report","code":"a1b2c3d4e5f6g7h8"}');
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
import requests
res = requests.post(
"https://leafpage.cc/api/setlatest",
headers={
"Authorization": "Bearer lp_…",
"Content-Type": "application/json",
},
json={
"name": "quarterly-report",
"code": "a1b2c3d4e5f6g7h8"
},
)
data = res.json()
require "net/http"
require "json"
uri = URI("https://leafpage.cc/api/setlatest")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer lp_…"
req["Content-Type"] = "application/json"
req.body = '{"name":"quarterly-report","code":"a1b2c3d4e5f6g7h8"}'
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
data = JSON.parse(res.body)
package main
import (
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"name":"quarterly-report","code":"a1b2c3d4e5f6g7h8"}`)
req, _ := http.NewRequest("POST", "https://leafpage.cc/api/setlatest", body)
req.Header.Set("Authorization", "Bearer lp_…")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
}
let client = reqwest::Client::new();
let res = client.post("https://leafpage.cc/api/setlatest")
.header("Authorization", "Bearer lp_…")
.header("Content-Type", "application/json")
.body(r#"{"name":"quarterly-report","code":"a1b2c3d4e5f6g7h8"}"#)
.send()
.await?;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://leafpage.cc/api/setlatest"))
.header("Authorization", "Bearer lp_…")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{"name":"quarterly-report","code":"a1b2c3d4e5f6g7h8"}"""))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://leafpage.cc/api/setlatest");
request.Headers.Add("Authorization", "Bearer lp_…");
request.Content = new StringContent("""{"name":"quarterly-report","code":"a1b2c3d4e5f6g7h8"}""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
curl -X POST "https://leafpage.cc/api/setlatest" \
-H "Authorization: Bearer lp_…" \
-H "Content-Type: application/json" \
-d '{"name":"quarterly-report","code":"a1b2c3d4e5f6g7h8"}'