Skip to content

Commit 9277e4b

Browse files
committed
file upload/download docs
1 parent bef7d04 commit 9277e4b

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

docs/howto/file_download.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
layout: default
3+
title: OpenAPI: describing a file download endpoint
4+
parent: HowTo's
5+
nav_order: 10
6+
---
7+
8+
Describing an endpoint to download file attachments.
9+
10+
```yaml
11+
/v1/attachments/{id}:
12+
get:
13+
summary: download an attachment
14+
parameters:
15+
- in: path
16+
name: id
17+
required: true
18+
schema:
19+
type: integer
20+
format: int64
21+
responses:
22+
200:
23+
description: attachment data
24+
headers:
25+
Content-Disposition:
26+
schema:
27+
type: string
28+
description: the format is `attachment; filename="name.zip"`
29+
content:
30+
application/*:
31+
schema:
32+
type: string
33+
format: binary
34+
image/*:
35+
schema:
36+
type: string
37+
format: binary
38+
```

docs/howto/file_upload.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
layout: default
3+
title: OpenAPI: describing a file upload endpoint
4+
parent: HowTo's
5+
nav_order: 15
6+
---
7+
8+
Describing and endpoint for uploading a singe file:
9+
10+
```yaml
11+
/attachments:
12+
summary: upload an attachment
13+
post:
14+
requestBody:
15+
content:
16+
multipart/form-data:
17+
schema:
18+
type: object
19+
properties:
20+
file:
21+
type: string
22+
format: binary
23+
responses:
24+
204:
25+
description: succesfully created attachment
26+
content:
27+
application/json:
28+
schema:
29+
type: integer
30+
format: int64
31+
```
32+
33+
Describing an endpoint for uploading multiple files:
34+
35+
```yaml
36+
/attachments:
37+
summary: upload multiple attachments
38+
post:
39+
requestBody:
40+
content:
41+
multipart/form-data:
42+
schema:
43+
type: object
44+
properties:
45+
files:
46+
type: array
47+
items:
48+
type: string
49+
format: binary
50+
responses:
51+
204:
52+
description: succesfully created attachment
53+
content:
54+
application/json:
55+
schema:
56+
type: array
57+
items:
58+
type: string
59+
format: int64
60+
```

0 commit comments

Comments
 (0)