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 PATCH and DELETE /users/me/profile_data.

Sachin Kumar79ab42ce5e70
diff --git a/api_docs/include/rest-endpoints.md b/api_docs/include/rest-endpoints.md
index b37c1ff5117..76ab99f1335 100644
--- a/api_docs/include/rest-endpoints.md
+++ b/api_docs/include/rest-endpoints.md
@@ -96,6 +96,8 @@
* [Get a user's status](/api/get-user-status)
* [Update your status](/api/update-status)
* [Update user status](/api/update-status-for-user)
+* [Update your profile data](/api/update-profile-data)
+* [Remove your profile data](/api/remove-profile-data)
* [Set "typing" status](/api/set-typing-status)
* [Set "typing" status for message editing](/api/set-typing-status-for-message-edit)
* [Get a user's presence](/api/get-user-presence)
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 996e37fe507..5564aaa55ee 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -12139,6 +12139,128 @@ paths:
"server_timestamp": 1656958539.6287155,
"presence_last_update_id": 1000,
}
+ /users/me/profile_data:
+ patch:
+ operationId: update-profile-data
+ summary: Update your profile data
+ tags: ["users"]
+ description: |
+ Update the current user's [profile data](/help/edit-your-profile) for
+ one or more of the [custom profile fields](/help/custom-profile-fields)
+ configured in the organization.
+ requestBody:
+ required: true
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ additionalProperties: false
+ properties:
+ data:
+ description: |
+ An array of objects describing updates to the custom profile
+ field data for the user.
+ type: array
+ example:
+ [{"id": 4, "value": "0"}, {"id": 5, "value": "1909-04-05"}]
+ items:
+ $ref: "#/components/schemas/ProfileDataUpdate"
+ required:
+ - data
+ encoding:
+ data:
+ contentType: application/json
+ responses:
+ "200":
+ $ref: "#/components/responses/SimpleSuccess"
+ "400":
+ description: Bad request.
+ content:
+ application/json:
+ schema:
+ oneOf:
+ - allOf:
+ - $ref: "#/components/schemas/CodedError"
+ - example:
+ {
+ "result": "error",
+ "msg": "You are not allowed to change this field. Contact an administrator to update it.",
+ "code": "BAD_REQUEST",
+ }
+ description: |
+ An example JSON error response when editing custom profile fields
+ is restricted in the organization:
+ - allOf:
+ - $ref: "#/components/schemas/CodedError"
+ - example:
+ {
+ "result": "error",
+ "msg": "Field id 99 not found.",
+ "code": "BAD_REQUEST",
+ }
+ description: |
+ An example JSON error response when a custom profile field
+ ID does not exist:
+ delete:
+ operationId: remove-profile-data
+ summary: Remove your profile data
+ tags: ["users"]
+ description: |
+ Remove the current user's [profile data](/help/edit-your-profile) for
+ one or more of the [custom profile fields](/help/custom-profile-fields)
+ configured in the organization.
+ requestBody:
+ required: true
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ additionalProperties: false
+ properties:
+ data:
+ description: |
+ An array of custom profile field IDs to remove any data set for
+ the user.
+ type: array
+ example: [1]
+ items:
+ type: integer
+ required:
+ - data
+ encoding:
+ data:
+ contentType: application/json
+ responses:
+ "200":
+ $ref: "#/components/responses/SimpleSuccess"
+ "400":
+ description: Bad request.
+ content:
+ application/json:
+ schema:
+ oneOf:
+ - allOf:
+ - $ref: "#/components/schemas/CodedError"
+ - example:
+ {
+ "result": "error",
+ "msg": "You are not allowed to change this field. Contact an administrator to update it.",
+ "code": "BAD_REQUEST",
+ }
+ description: |
+ An example JSON error response when editing custom profile fields
+ is restricted in the organization:
+ - allOf:
+ - $ref: "#/components/schemas/CodedError"
+ - example:
+ {
+ "result": "error",
+ "msg": "Field id 99 not found.",
+ "code": "BAD_REQUEST",
+ }
+ description: |
+ An example JSON error response when a custom profile field
+ ID does not exist:
/users/me/status:
post:
operationId: update-status
diff --git a/zerver/tests/test_openapi.py b/zerver/tests/test_openapi.py
index aafdde486e0..0a1887ff670 100644
--- a/zerver/tests/test_openapi.py
+++ b/zerver/tests/test_openapi.py
@@ -224,8 +224,6 @@ class OpenAPIArgumentsTest(ZulipTestCase):
"/default_stream_groups/{group_id}/streams",
#### These personal settings endpoints have modest value to document:
"/users/me/avatar",
- # Much more valuable would be an org admin bulk-upload feature.
- "/users/me/profile_data",
#### Should be documented as part of interactive bots documentation
"/bot_storage",
"/submessage",