Create bucket
curl --request POST \
--url https://api.example.com/api/s3/buckets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bucket": "<string>",
"endpoint": "<string>",
"accesskey": "<string>",
"secretkey": "<string>"
}
'import requests
url = "https://api.example.com/api/s3/buckets"
payload = {
"bucket": "<string>",
"endpoint": "<string>",
"accesskey": "<string>",
"secretkey": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
bucket: '<string>',
endpoint: '<string>',
accesskey: '<string>',
secretkey: '<string>'
})
};
fetch('https://api.example.com/api/s3/buckets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/s3/buckets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bucket' => '<string>',
'endpoint' => '<string>',
'accesskey' => '<string>',
'secretkey' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/s3/buckets"
payload := strings.NewReader("{\n \"bucket\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"accesskey\": \"<string>\",\n \"secretkey\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/s3/buckets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bucket\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"accesskey\": \"<string>\",\n \"secretkey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/s3/buckets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bucket\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"accesskey\": \"<string>\",\n \"secretkey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"bucket": "<string>",
"endpoint": "<string>",
"accesskey": "<string>",
"secretkey": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Object storage
Create bucket
Create a new S3 bucket record by specifying its connection details.
POST
/
api
/
s3
/
buckets
Create bucket
curl --request POST \
--url https://api.example.com/api/s3/buckets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bucket": "<string>",
"endpoint": "<string>",
"accesskey": "<string>",
"secretkey": "<string>"
}
'import requests
url = "https://api.example.com/api/s3/buckets"
payload = {
"bucket": "<string>",
"endpoint": "<string>",
"accesskey": "<string>",
"secretkey": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
bucket: '<string>',
endpoint: '<string>',
accesskey: '<string>',
secretkey: '<string>'
})
};
fetch('https://api.example.com/api/s3/buckets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/s3/buckets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bucket' => '<string>',
'endpoint' => '<string>',
'accesskey' => '<string>',
'secretkey' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/s3/buckets"
payload := strings.NewReader("{\n \"bucket\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"accesskey\": \"<string>\",\n \"secretkey\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/s3/buckets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bucket\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"accesskey\": \"<string>\",\n \"secretkey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/s3/buckets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bucket\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"accesskey\": \"<string>\",\n \"secretkey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"bucket": "<string>",
"endpoint": "<string>",
"accesskey": "<string>",
"secretkey": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
OAuth2AuthorizationCodeBearerAPIKeyHeader
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/json
Response
S3 Bucket created successfully.
The unique name of the created S3 bucket.
The endpoint URL of the created S3 bucket.
Access key for the created S3 bucket.
Secret key for the created S3 bucket.
S3 bucket creation timestamp.
Timestamp when the S3 bucket was last updated.
Was this page helpful?
⌘I

