API 定义
导入和配置您的 API 规范
多部分文件上传
Fern 中的端点定义在 endpoints 键下。如果您的端点请求包含文件上传,您可以使用 file 类型来指示请求是 multiform 内容类型。下面的示例演示了一个在请求体中包含文件的端点。
endpoints
file
multiform
1service:2 base-path: /documents3 auth: false4 endpoints:5 uploadDocument:6 path: /upload7 method: POST8 request:9 name: UploadDocumentRequest10 body:11 properties:12 file: file
在给定的多部分请求中,带有 format:binary 的字符串参数将表示任意文件。
format:binary
如果您的端点支持文件列表,那么您的请求体必须指明这一点。
1service:2 base-path: /documents3 auth: false4 endpoints:5 uploadDocuments:6 path: /upload7 method: POST8 request:9 name: UploadDocumentsRequest10 body:11 properties:12 files: list<file>