2
0

📝 Add generate upload url endpoint api doc

This commit is contained in:
Baptiste Arnaud
2024-06-20 10:53:17 +02:00
parent 918836d6cf
commit 033f52e9f3
11 changed files with 432 additions and 82 deletions

View File

@@ -0,0 +1,20 @@
---
title: 'Generate upload URL'
openapi: POST /v2/generate-upload-url
---
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:
```js
// 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,
})
```