Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add example to each endpoint when the capability is not available.
36 changes: 36 additions & 0 deletions data/api/client-server/administrative_contact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ paths:
value: {
"submit_url": "https://example.org/path/to/submitToken"
}
"400":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do these status codes choices come from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original MSC3283 did not specify the expected response code and referred to the Synapse implementation. So, I took these values from the Synapse implementation.

Another approach to the clarification would be to specify a range. e.g. 400-499

description: The 3PID changes capability is not available.
content:
application/json:
schema:
$ref: definitions/errors/error.yaml
examples:
response:
value: {
"errcode": "M_FORBIDDEN",
"error": "3PID changes are disabled on this server."
}
"403":
description: The credentials could not be verified with the identity server.
content:
Expand Down Expand Up @@ -244,6 +256,18 @@ paths:
examples:
response:
value: {}
"400":
description: The 3PID changes capability is not available.
content:
application/json:
schema:
$ref: definitions/errors/error.yaml
examples:
response:
value: {
"errcode": "M_FORBIDDEN",
"error": "3PID changes are disabled on this server."
}
"401":
description: The homeserver requires additional authentication information.
content:
Expand Down Expand Up @@ -389,6 +413,18 @@ paths:
example: success
required:
- id_server_unbind_result
"400":
description: The 3PID changes capability is not available.
content:
application/json:
schema:
$ref: definitions/errors/error.yaml
examples:
response:
value: {
"errcode": "M_FORBIDDEN",
"error": "3PID changes are disabled on this server."
}
tags:
- Account management
/account/3pid/unbind:
Expand Down
12 changes: 12 additions & 0 deletions data/api/client-server/login_token.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ paths:
application/json:
schema:
$ref: definitions/auth_response.yaml
"404":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm re-reading MSC3882 now (which I happened to author). The suggested 404 here is based on Synapse implementation.

An alternative would be:

  • 404 M_UNRECOGNIZED = the server does not implement the optional login token feature
  • 400 (or 403) M_FORBIDDEN = the user is not allowed to do this (i.e. capability would return false)

description: The get login token capability is not available.
content:
application/json:
schema:
$ref: definitions/errors/error.yaml
examples:
response:
value: {
"errcode": "M_UNRECOGNIZED",
"error": "The get login token capability is not available."
}
"429":
description: This request was rate-limited.
content:
Expand Down
12 changes: 12 additions & 0 deletions data/api/client-server/password_management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ paths:
application/json:
schema:
$ref: definitions/auth_response.yaml
"403":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description: The password change capability is not available.
content:
application/json:
schema:
$ref: definitions/errors/error.yaml
examples:
response:
value: {
"errcode": "M_FORBIDDEN",
"error": "Password change is disabled."
}
"429":
description: This request was rate-limited.
content:
Expand Down
6 changes: 6 additions & 0 deletions data/api/client-server/profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ paths:
"errcode": "M_INVALID_PARAM",
"error": "Invalid profile key.",
}
capability_disabled:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this code was based on the Synapse implementation.

value:
{
"errcode": "M_FORBIDDEN",
"error": "Profile modification is disabled on this homeserver.",
}
"403":
description: The server is unwilling to perform the operation, either
due to insufficient permissions or because profile modifications
Expand Down