cURL
curl --request POST \
--url 'https://api.kloo.li/v1/links' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'type=static' \
--form 'name=My landing' \
--form 'file=@/path/to/site.zip'
const formData = new FormData();
formData.append('type', 'static');
formData.append('name', 'My landing');
formData.append('file', '@/path/to/site.zip');
const response = await fetch('https://api.kloo.li/v1/links', {
method: 'POST',
headers: { Authorization: 'Bearer {api_key}' },
body: formData
});
const data = await response.json();
console.log(data);
import requests
url = 'https://api.kloo.li/v1/links'
headers = {'Authorization': 'Bearer {api_key}'}
data = {
'type': 'static',
'name': 'My landing',
'file': '@/path/to/site.zip'
}
response = requests.request('POST', url, headers=headers, data=data)
print(response.json())
<?php
$ch = curl_init('https://api.kloo.li/v1/links');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer {api_key}'],
CURLOPT_POSTFIELDS => [
'type' => 'static',
'name' => 'My landing',
'file' => '@/path/to/site.zip'
],
]);
echo curl_exec($ch);
curl_close($ch);
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
)
func main() {
var body bytes.Buffer
writer := multipart.NewWriter(&body)
_ = writer.WriteField("type", "static")
_ = writer.WriteField("name", "My landing")
_ = writer.WriteField("file", "@/path/to/site.zip")
_ = writer.Close()
req, _ := http.NewRequest("POST", "https://api.kloo.li/v1/links", &body)
req.Header.Set("Authorization", "Bearer {api_key}")
req.Header.Set("Content-Type", writer.FormDataContentType())
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
fmt.Println(string(data))
}
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.kloo.li/v1/links"))
.header("Authorization", "Bearer {api_key}")
.header("Content-Type", "application/x-www-form-urlencoded")
.method("POST", HttpRequest.BodyPublishers.ofString("type=static&name=My landing&file=@/path/to/site.zip"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer {api_key}");
var content = new FormUrlEncodedContent(new Dictionary<string, string> { { "type", "static" }, { "name", "My landing" }, { "file", "@/path/to/site.zip" } });
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.kloo.li/v1/links") { Content = content };
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
require 'net/http'
require 'uri'
uri = URI('https://api.kloo.li/v1/links')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer {api_key}'
req.set_form_data('type' => 'static', 'name' => 'My landing', 'file' => '@/path/to/site.zip')
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.body
{
"data": {
"id": 12,
"type": "static",
"url": "abc12xy",
"settings": {
"name": "My landing"
},
"additional": {
"mode": "file",
"static_folder": "...",
"files": [
"index.html"
],
"total_files": 1
}
}
}
Liens et pages
Créer un site statique
Liens et pages — Créer un site statique. POST /links
POST
/
links
cURL
curl --request POST \
--url 'https://api.kloo.li/v1/links' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'type=static' \
--form 'name=My landing' \
--form 'file=@/path/to/site.zip'
const formData = new FormData();
formData.append('type', 'static');
formData.append('name', 'My landing');
formData.append('file', '@/path/to/site.zip');
const response = await fetch('https://api.kloo.li/v1/links', {
method: 'POST',
headers: { Authorization: 'Bearer {api_key}' },
body: formData
});
const data = await response.json();
console.log(data);
import requests
url = 'https://api.kloo.li/v1/links'
headers = {'Authorization': 'Bearer {api_key}'}
data = {
'type': 'static',
'name': 'My landing',
'file': '@/path/to/site.zip'
}
response = requests.request('POST', url, headers=headers, data=data)
print(response.json())
<?php
$ch = curl_init('https://api.kloo.li/v1/links');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer {api_key}'],
CURLOPT_POSTFIELDS => [
'type' => 'static',
'name' => 'My landing',
'file' => '@/path/to/site.zip'
],
]);
echo curl_exec($ch);
curl_close($ch);
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
)
func main() {
var body bytes.Buffer
writer := multipart.NewWriter(&body)
_ = writer.WriteField("type", "static")
_ = writer.WriteField("name", "My landing")
_ = writer.WriteField("file", "@/path/to/site.zip")
_ = writer.Close()
req, _ := http.NewRequest("POST", "https://api.kloo.li/v1/links", &body)
req.Header.Set("Authorization", "Bearer {api_key}")
req.Header.Set("Content-Type", writer.FormDataContentType())
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
fmt.Println(string(data))
}
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.kloo.li/v1/links"))
.header("Authorization", "Bearer {api_key}")
.header("Content-Type", "application/x-www-form-urlencoded")
.method("POST", HttpRequest.BodyPublishers.ofString("type=static&name=My landing&file=@/path/to/site.zip"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer {api_key}");
var content = new FormUrlEncodedContent(new Dictionary<string, string> { { "type", "static" }, { "name", "My landing" }, { "file", "@/path/to/site.zip" } });
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.kloo.li/v1/links") { Content = content };
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
require 'net/http'
require 'uri'
uri = URI('https://api.kloo.li/v1/links')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer {api_key}'
req.set_form_data('type' => 'static', 'name' => 'My landing', 'file' => '@/path/to/site.zip')
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.body
{
"data": {
"id": 12,
"type": "static",
"url": "abc12xy",
"settings": {
"name": "My landing"
},
"additional": {
"mode": "file",
"static_folder": "...",
"files": [
"index.html"
],
"total_files": 1
}
}
}
Publiez un site statique depuis un fichier
.html ou une archive .zip. Le site publié doit inclure index.html à la racine de déploiement.
Collez votre clé API dans le champ Authorization :
Bearer {api_key}.string
requis
Doit être
static.string
requis
Nom d’affichage du site (128 caractères max).
file
requis
Uploadez un
.html (stocké comme index.html) ou un .zip avec un index.html déployable à la racine.string
Alias personnalisé. Vide = aléatoire.
integer
ID du domaine.
0 = domaine principal.integer
ID du projet appartenant à l’utilisateur authentifié.
boolean
Activer le site. Défaut :
1.string
Mot de passe visiteur optionnel (64 caractères max).
cURL
curl --request POST \
--url 'https://api.kloo.li/v1/links' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'type=static' \
--form 'name=My landing' \
--form 'file=@/path/to/site.zip'
const formData = new FormData();
formData.append('type', 'static');
formData.append('name', 'My landing');
formData.append('file', '@/path/to/site.zip');
const response = await fetch('https://api.kloo.li/v1/links', {
method: 'POST',
headers: { Authorization: 'Bearer {api_key}' },
body: formData
});
const data = await response.json();
console.log(data);
import requests
url = 'https://api.kloo.li/v1/links'
headers = {'Authorization': 'Bearer {api_key}'}
data = {
'type': 'static',
'name': 'My landing',
'file': '@/path/to/site.zip'
}
response = requests.request('POST', url, headers=headers, data=data)
print(response.json())
<?php
$ch = curl_init('https://api.kloo.li/v1/links');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer {api_key}'],
CURLOPT_POSTFIELDS => [
'type' => 'static',
'name' => 'My landing',
'file' => '@/path/to/site.zip'
],
]);
echo curl_exec($ch);
curl_close($ch);
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
)
func main() {
var body bytes.Buffer
writer := multipart.NewWriter(&body)
_ = writer.WriteField("type", "static")
_ = writer.WriteField("name", "My landing")
_ = writer.WriteField("file", "@/path/to/site.zip")
_ = writer.Close()
req, _ := http.NewRequest("POST", "https://api.kloo.li/v1/links", &body)
req.Header.Set("Authorization", "Bearer {api_key}")
req.Header.Set("Content-Type", writer.FormDataContentType())
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
fmt.Println(string(data))
}
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.kloo.li/v1/links"))
.header("Authorization", "Bearer {api_key}")
.header("Content-Type", "application/x-www-form-urlencoded")
.method("POST", HttpRequest.BodyPublishers.ofString("type=static&name=My landing&file=@/path/to/site.zip"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer {api_key}");
var content = new FormUrlEncodedContent(new Dictionary<string, string> { { "type", "static" }, { "name", "My landing" }, { "file", "@/path/to/site.zip" } });
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.kloo.li/v1/links") { Content = content };
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
require 'net/http'
require 'uri'
uri = URI('https://api.kloo.li/v1/links')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer {api_key}'
req.set_form_data('type' => 'static', 'name' => 'My landing', 'file' => '@/path/to/site.zip')
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.body
{
"data": {
"id": 12,
"type": "static",
"url": "abc12xy",
"settings": {
"name": "My landing"
},
"additional": {
"mode": "file",
"static_folder": "...",
"files": [
"index.html"
],
"total_files": 1
}
}
}
⌘I

