Chat
Generate upload URL
Used to upload anything from the client to S3 bucket
POST
/
v1
/
generate-upload-url
Generate upload URL
curl --request POST \
--url https://quick.bot/api/v1/generate-upload-url \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"fileType": "<string>"
}
'import requests
url = "https://quick.bot/api/v1/generate-upload-url"
payload = {
"fileName": "<string>",
"fileType": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({fileName: '<string>', fileType: '<string>'})
};
fetch('https://quick.bot/api/v1/generate-upload-url', 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://quick.bot/api/v1/generate-upload-url",
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([
'fileName' => '<string>',
'fileType' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://quick.bot/api/v1/generate-upload-url"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"fileType\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://quick.bot/api/v1/generate-upload-url")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\",\n \"fileType\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://quick.bot/api/v1/generate-upload-url")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"<string>\",\n \"fileType\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"presignedUrl": "<string>",
"formData": {},
"fileUrl": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}The
presignedUrl and formData fields can be then used to upload the file to the S3 bucket,
directly from the browser if necessary. Here is an example:
// data contains the presignedUrl and formData fields from the response
const formData = new FormData()
Object.entries(data.formData).forEach(([key, value]) => {
formData.append(key, value)
})
formData.append('file', file)
const upload = await fetch(data.presignedUrl, {
method: 'POST',
body: formData,
})
⌘I
Generate upload URL
curl --request POST \
--url https://quick.bot/api/v1/generate-upload-url \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"fileType": "<string>"
}
'import requests
url = "https://quick.bot/api/v1/generate-upload-url"
payload = {
"fileName": "<string>",
"fileType": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({fileName: '<string>', fileType: '<string>'})
};
fetch('https://quick.bot/api/v1/generate-upload-url', 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://quick.bot/api/v1/generate-upload-url",
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([
'fileName' => '<string>',
'fileType' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://quick.bot/api/v1/generate-upload-url"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"fileType\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://quick.bot/api/v1/generate-upload-url")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\",\n \"fileType\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://quick.bot/api/v1/generate-upload-url")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"<string>\",\n \"fileType\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"presignedUrl": "<string>",
"formData": {},
"fileUrl": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}