Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): update Files Service documentation #1965

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
15 changes: 14 additions & 1 deletion docs/runtime_suite/files-service/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,25 @@ At the moment, the file part must be the last one of the multipart. Any other pa
This API supports only one file per request. If the request contains more files, then only the first one will be uploaded. Consider using `POST /bulk` to upload multiple files at once.
:::

This endpoint allows choosing a custom file name by specifying the `filename` field inside the caster file:
```
module.exports = function caster(doc) {
return {
filename: doc?.filename || undefined,
}
}

module.exports.additionalPropertiesValidator = {
filename: { type: 'string', description: 'custom name of the file to upload' }
}
```

#### Response

In case of success, the response is a JSON with the following fields.

* _id: unique MongoDB identifier.
* name: original file name.
* name: original file name or custom file name.
* file: unique name of the file that should be used to retrieve it using this service.
* size: size in bytes of the uploaded file.
* location: the URL that can be used to download the file using the same service that performed the upload.
Expand Down