const res = await fetch("https://leafpage.cc/api/set-visibility", {
method: "POST",
headers: {
"Authorization": "Bearer lp_…",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "quarterly-report",
"visibility": "public"
}),
});
const data = await res.json();
$ch = curl_init("https://leafpage.cc/api/set-visibility");
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","visibility":"public"}');
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
import requests
res = requests.post(
"https://leafpage.cc/api/set-visibility",
headers={
"Authorization": "Bearer lp_…",
"Content-Type": "application/json",
},
json={
"name": "quarterly-report",
"visibility": "public"
},
)
data = res.json()
require "net/http"
require "json"
uri = URI("https://leafpage.cc/api/set-visibility")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer lp_…"
req["Content-Type"] = "application/json"
req.body = '{"name":"quarterly-report","visibility":"public"}'
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","visibility":"public"}`)
req, _ := http.NewRequest("POST", "https://leafpage.cc/api/set-visibility", 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/set-visibility")
.header("Authorization", "Bearer lp_…")
.header("Content-Type", "application/json")
.body(r#"{"name":"quarterly-report","visibility":"public"}"#)
.send()
.await?;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://leafpage.cc/api/set-visibility"))
.header("Authorization", "Bearer lp_…")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{"name":"quarterly-report","visibility":"public"}"""))
.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/set-visibility");
request.Headers.Add("Authorization", "Bearer lp_…");
request.Content = new StringContent("""{"name":"quarterly-report","visibility":"public"}""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
curl -X POST "https://leafpage.cc/api/set-visibility" \
-H "Authorization: Bearer lp_…" \
-H "Content-Type: application/json" \
-d '{"name":"quarterly-report","visibility":"public"}'