mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 23:43:43 +00:00
api: Document DELETE ../users/{user_id} endpoint.
This adds deactivate_user to python_examples.py in zerver/openapi. This also adds delete-user.md to templates/zerver/api and adds delete-user to rest-endpoints.md (templates/zerver/help/include).
This commit is contained in:
39
templates/zerver/api/deactivate-user.md
Normal file
39
templates/zerver/api/deactivate-user.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Deactivate a user
|
||||
|
||||
{!api-admin-only.md!}
|
||||
|
||||
[Deactivates a
|
||||
user](https://zulipchat.com/help/deactivate-or-reactivate-a-user)
|
||||
given their user ID.
|
||||
|
||||
`DELETE {{ api_url }}/v1/users/{user_id}`
|
||||
|
||||
## Usage examples
|
||||
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/users/{user_id}:delete|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
{generate_code_example(curl)|/users/{user_id}:delete|example}
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
{generate_api_arguments_table|zulip.yaml|/users/{user_id}:delete}
|
||||
|
||||
## Response
|
||||
|
||||
#### Example response
|
||||
|
||||
A typical successful JSON response may look like:
|
||||
|
||||
{generate_code_example|/users/{user_id}:delete|fixture(200)}
|
||||
|
||||
An example JSON error response when attempting to deactivate the only
|
||||
organization administrator:
|
||||
|
||||
{generate_code_example|/users/{user_id}:delete|fixture(400)}
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
* [Get all users](/api/get-all-users)
|
||||
* [Get a user](/api/get-user)
|
||||
* [Deactivate a user](/api/deactivate-user)
|
||||
* [Get profile](/api/get-profile)
|
||||
* [Create a user](/api/create-user)
|
||||
* [Set "typing" status](/api/typing)
|
||||
|
||||
@@ -242,6 +242,21 @@ def get_single_user(client):
|
||||
|
||||
validate_against_openapi_schema(result, '/users/{user_id}', 'get', '200')
|
||||
|
||||
@openapi_test_function("/users/{user_id}:delete")
|
||||
def deactivate_user(client):
|
||||
# type: (Client) -> None
|
||||
|
||||
# {code_example|start}
|
||||
# Deactivate a user
|
||||
user_id = 8
|
||||
url = 'users/' + str(user_id)
|
||||
result = client.call_endpoint(
|
||||
url=url,
|
||||
method='DELETE',
|
||||
)
|
||||
# {code_example|end}
|
||||
validate_against_openapi_schema(result, '/users/{user_id}', 'delete', '200')
|
||||
|
||||
@openapi_test_function("/realm/filters:get")
|
||||
def get_realm_filters(client):
|
||||
# type: (Client) -> None
|
||||
@@ -1150,6 +1165,7 @@ def test_users(client):
|
||||
create_user(client)
|
||||
get_members(client)
|
||||
get_single_user(client)
|
||||
deactivate_user(client)
|
||||
get_profile(client)
|
||||
update_notification_settings(client)
|
||||
upload_file(client)
|
||||
|
||||
Reference in New Issue
Block a user