Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

api docs: Document GET /realm/profile_fields endpoint.

Kartik Srivastavaf8d6b9755a65
diff --git a/templates/zerver/api/get-custom-profile-fields.md b/templates/zerver/api/get-custom-profile-fields.md
new file mode 100644
index 00000000000..37e627da1a8
--- /dev/null
+++ b/templates/zerver/api/get-custom-profile-fields.md
@@ -0,0 +1,33 @@
+# Get all custom profile fields
+
+{generate_api_description(/realm/profile_fields:get)}
+
+## Usage examples
+
+{start_tabs}
+{tab|python}
+
+{generate_code_example(python)|/realm/profile_fields:get|example}
+
+{tab|curl}
+
+{generate_code_example(curl)|/realm/profile_fields:get|example}
+
+{end_tabs}
+
+## Parameters
+
+{generate_api_arguments_table|zulip.yaml|/realm/profile_fields:get}
+
+## Response
+
+#### Return values
+
+{generate_return_values_table|zulip.yaml|/realm/profile_fields:get}
+
+
+#### Example response
+
+A typical successful JSON response may look like:
+
+{generate_code_example|/realm/profile_fields:get|fixture(200)}
diff --git a/templates/zerver/help/include/rest-endpoints.md b/templates/zerver/help/include/rest-endpoints.md
index 448b22d3b21..dbb7c128917 100644
--- a/templates/zerver/help/include/rest-endpoints.md
+++ b/templates/zerver/help/include/rest-endpoints.md
@@ -56,6 +56,7 @@
* [Remove a linkifier](/api/remove-linkifier)
* [Get all custom emoji](/api/get-custom-emoji)
* [Upload custom emoji](/api/upload-custom-emoji)
+* [Get all custom profile fields](/api/get-custom-profile-fields)
#### Real-time events
diff --git a/zerver/openapi/python_examples.py b/zerver/openapi/python_examples.py
index c682615fd7d..40a764ed2d2 100644
--- a/zerver/openapi/python_examples.py
+++ b/zerver/openapi/python_examples.py
@@ -275,6 +275,17 @@ def get_realm_filters(client: Client) -> None:
validate_against_openapi_schema(result, '/realm/filters', 'get', '200')
+@openapi_test_function("/realm/profile_fields:get")
+def get_realm_profile_fields(client: Client) -> None:
+ # {code_example|start}
+ # Fetch all the custom profile fields in the user's organization.
+ result = client.call_endpoint(
+ url='/realm/profile_fields',
+ method='GET',
+ )
+ # {code_example|end}
+ validate_against_openapi_schema(result, '/realm/profile_fields', 'get', '200')
+
@openapi_test_function("/realm/filters:post")
def add_realm_filter(client: Client) -> None:
@@ -1234,6 +1245,7 @@ def test_server_organizations(client: Client) -> None:
remove_realm_filter(client)
get_realm_emoji(client)
upload_custom_emoji(client)
+ get_realm_profile_fields(client)
def test_errors(client: Client) -> None:
test_missing_request_argument(client)