Skip to content

Commit 770593c

Browse files
authored
Merge pull request #75 from glideapps/file-upload
Docs for the new file upload API
2 parents 605c46a + bc10aea commit 770593c

File tree

5 files changed

+410
-1
lines changed

5 files changed

+410
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Complete Upload
3+
openapi: post /apps/{appID}/uploads/{uploadID}/complete
4+
---
5+
6+
Finalize an upload and receive the public URL for the file. Use the `uploadID` from the create upload response.
7+
8+
If the uploaded object is missing or incomplete, this endpoint returns a 409.
9+
10+
Note that Glide will delete this file within 30 days if the URL is not stored in a table in Glide.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Create Upload
3+
openapi: post /apps/{appID}/uploads
4+
---
5+
6+
Create an upload session and get a pre-signed upload URL. Upload the file bytes to the `uploadLocation`, then call the complete endpoint to finalize the file and receive a public URL.
7+
8+
## Example
9+
10+
```bash
11+
curl --request POST \
12+
--url https://api.glideapps.com/apps/$APP_ID/uploads \
13+
--header "Authorization: Bearer $GLIDE_API_KEY" \
14+
--header "Content-Type: application/json" \
15+
--data '{
16+
"contentType": "image/png",
17+
"contentLength": 1024,
18+
"fileName": "logo.png"
19+
}'
20+
```
21+
22+
Response:
23+
24+
```json
25+
{
26+
"data": {
27+
"uploadID": "upload-123",
28+
"uploadLocation": "https://storage.googleapis.com/glide-uploads/example?X-Goog-Algorithm=GOOG4-RSA-SHA256"
29+
}
30+
}
31+
```
32+
33+
Then upload the file bytes to `uploadLocation`:
34+
35+
```bash
36+
curl --request PUT \
37+
--url "$UPLOAD_LOCATION" \
38+
--header "Content-Type: image/png" \
39+
--upload-file ./logo.png
40+
```
41+
42+
Finally, complete the upload:
43+
44+
```bash
45+
curl --request POST \
46+
--url https://api.glideapps.com/apps/$APP_ID/uploads/$UPLOAD_ID/complete \
47+
--header "Authorization: Bearer $GLIDE_API_KEY"
48+
```
49+
50+
Note that Glide will delete this file within 30 days if the URL is not stored in a table in Glide.

docs.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
"api-reference/v2/jobs/get-job"
4949
]
5050
},
51+
{
52+
"group": "Uploads",
53+
"pages": [
54+
"api-reference/v2/uploads/post-apiapps-uploads",
55+
"api-reference/v2/uploads/post-apiapps-uploads-uploadid-complete"
56+
]
57+
},
5158
{
5259
"group": "Tutorials",
5360
"pages": [
@@ -87,4 +94,4 @@
8794
"linkedin": "https://www.linkedin.com/company/glideapps/"
8895
}
8996
}
90-
}
97+
}

0 commit comments

Comments
 (0)