docs: Explain link sharing in /api/upload-file.

Rewrittten by tabbott to clearly explain the security model, and add a
code example.
This commit is contained in:
David Rosa 2019-11-29 16:10:18 -08:00 committed by Tim Abbott
parent b036fa897e
commit 1be4e10a2d
2 changed files with 16 additions and 0 deletions

View File

@ -4,6 +4,15 @@ Upload a single file and get the corresponding URI.
`POST {{ api_url }}/v1/user_uploads`
Initially, only you will be able to access the link. To share the
uploaded file, you'll need to [send a message][send-message]
containing the resulting link. Users who can already access the link
can reshare it with other users by sending additional Zulip messages
containing the link.
[uploaded-files]: /help/manage-your-uploaded-files
[send-message]: /api/send-message
## Usage examples
{start_tabs}

View File

@ -882,6 +882,13 @@ def upload_file(client):
method='POST',
files=[fp]
)
client.send_message({
"type": "stream",
"to": "Denmark",
"topic": "Castle",
"content": "Check out [this picture](%s) of my castle!" % (result['uri'],)
})
# {code_example|end}
validate_against_openapi_schema(result, '/user_uploads', 'post', '200')