Multipart File Upload

Endpoints in Fern are defined underneath the endpoints key. If your endpoint request includes file uploads, you can use the file type to indicate the request is of a multiform content type. The example below demonstrates an endpoint which includes a file in the request body.

document.yml
1service:
2 base-path: /documents
3 auth: false
4 endpoints:
5 uploadDocument:
6 path: /upload
7 method: POST
8 request:
9 name: UploadDocumentRequest
10 body:
11 properties:
12 file: file

Within a given multipart request, a string parameter with format:binary will represent an arbitrary file.

List of Files

If your endpoint supports a list of files, then your request body must indicate such.

document.yml
1service:
2 base-path: /documents
3 auth: false
4 endpoints:
5 uploadDocuments:
6 path: /upload
7 method: POST
8 request:
9 name: UploadDocumentsRequest
10 body:
11 properties:
12 files: list<file>