Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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 note to each endpoint that uses capability negotiation and document expected response when the capability is not available.
48 changes: 48 additions & 0 deletions data/api/client-server/administrative_contact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ paths:
has been removed, making this endpoint behave as though it was `false`.
This results in this endpoint being an equivalent to `/3pid/bind` rather
than dual-purpose.

This endpoint uses [capabilities negotiation](/client-server-api/#capabilities-negotiation).
Clients SHOULD check the value of the [`m.3pid_changes` capability](/client-server-api/#m3pid_changes-capability)
to determine if this endpoint is available.
operationId: post3PIDs
deprecated: true
security:
Expand Down Expand Up @@ -176,6 +180,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 All @@ -202,6 +218,10 @@ paths:
Homeservers should prevent the caller from adding a 3PID to their account if it has
already been added to another user's account on the homeserver.

This endpoint uses [capabilities negotiation](/client-server-api/#capabilities-negotiation).
Clients SHOULD check the value of the [`m.3pid_changes` capability](/client-server-api/#m3pid_changes-capability)
to determine if this endpoint is available.

{{% boxes/warning %}}
Since this endpoint uses User-Interactive Authentication, it cannot be used when the access token was obtained
via the [OAuth 2.0 API](/client-server-api/#oauth-20-api).
Expand Down Expand Up @@ -244,6 +264,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 @@ -331,6 +363,10 @@ paths:
Unlike other endpoints, this endpoint does not take an `id_access_token`
parameter because the homeserver is expected to sign the request to the
identity server instead.

This endpoint uses [capabilities negotiation](/client-server-api/#capabilities-negotiation).
Clients SHOULD check the value of the [`m.3pid_changes` capability](/client-server-api/#m3pid_changes-capability)
to determine if this endpoint is available.
operationId: delete3pidFromAccount
security:
- accessTokenQuery: []
Expand Down Expand Up @@ -389,6 +425,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
16 changes: 16 additions & 0 deletions data/api/client-server/password_management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ paths:
valid access token is provided. The homeserver SHOULD NOT revoke the
access token provided in the request. Whether other access tokens for
the user are revoked depends on the request parameters.

This endpoint uses [capabilities negotiation](/client-server-api/#capabilities-negotiation).
Clients SHOULD check the value of the [`m.change_password` capability](/client-server-api/#mchange_password-capability)
to determine if this endpoint is available.
security:
- {}
- accessTokenQuery: []
Expand Down Expand Up @@ -82,6 +86,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
11 changes: 11 additions & 0 deletions data/api/client-server/profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ paths:
Servers MAY reject `null` values. Servers that accept `null` values SHOULD store
them rather than treating `null` as a deletion request. Clients that want to delete a
field, including its key and value, SHOULD use the `DELETE` endpoint instead.

This endpoint uses [capabilities negotiation](/client-server-api/#capabilities-negotiation)
depending on the `keyName`.
For the `displayname` key, clients SHOULD check the value of the [`m.set_displayname` capability](/client-server-api/#mset_displayname-capability).
For the `avatar_url` key, clients SHOULD check the value of the [`m.set_avatar_url` capability](/client-server-api/#mset_avatar_url-capability).
operationId: setProfileField
security:
- accessTokenQuery: []
Expand Down Expand Up @@ -116,6 +121,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