2018-02-25 01:01:45 +01:00
|
|
|
# Upload a file
|
|
|
|
|
|
|
|
Upload a single file and get the corresponding URI.
|
|
|
|
|
2018-06-21 03:04:05 +02:00
|
|
|
`POST {{ api_url }}/v1/user_uploads`
|
2018-02-25 01:01:45 +01:00
|
|
|
|
|
|
|
## Usage examples
|
|
|
|
<div class="code-section" markdown="1">
|
|
|
|
<ul class="nav">
|
|
|
|
<li data-language="python">Python</li>
|
|
|
|
</ul>
|
|
|
|
<div class="blocks">
|
|
|
|
|
|
|
|
<div data-language="python" markdown="1">
|
|
|
|
|
2018-06-21 03:04:05 +02:00
|
|
|
{generate_code_example(python)|/user_uploads:post|example}
|
2018-02-25 01:01:45 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
## Arguments
|
|
|
|
|
2018-06-21 03:04:05 +02:00
|
|
|
The file to upload must be provided, and it should be placed in the request's
|
|
|
|
body as `multipart` media type.
|
2018-02-25 01:01:45 +01:00
|
|
|
|
|
|
|
## Maximum file size
|
|
|
|
|
|
|
|
The maximum file size for uploads can be configured by the
|
|
|
|
administrator of the Zulip server by setting `MAX_FILE_UPLOAD_SIZE`
|
|
|
|
in the [server's settings][1]. `MAX_FILE_UPLOAD_SIZE` defaults
|
|
|
|
to 25MB.
|
|
|
|
|
|
|
|
[1]: https://zulip.readthedocs.io/en/latest/subsystems/settings.html#server-settings
|
|
|
|
|
|
|
|
## Response
|
|
|
|
|
|
|
|
#### Return values
|
|
|
|
|
|
|
|
* `uri`: The URI of the uploaded file.
|
|
|
|
|
|
|
|
#### Example response
|
|
|
|
|
|
|
|
A typical successful JSON response may look like:
|
|
|
|
|
2018-06-21 03:04:05 +02:00
|
|
|
{generate_code_example|/user_uploads:post|fixture(200)}
|