Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add standard error responses (MSC3743). #1347

Merged
merged 6 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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 information on standard error responses for unknown endpoints/methods.
1 change: 1 addition & 0 deletions changelogs/client_server/newsfragments/1347.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add information on standard error responses for unknown endpoints/methods.
1 change: 1 addition & 0 deletions changelogs/identity_service/newsfragments/1347.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add information on standard error responses for unknown endpoints/methods.
1 change: 1 addition & 0 deletions changelogs/push_gateway/newsfragments/1347.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add information on standard error responses for unknown endpoints/methods.
1 change: 1 addition & 0 deletions changelogs/server_server/newsfragments/1347.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add information on standard error responses for unknown endpoints/methods.
8 changes: 8 additions & 0 deletions content/application-service-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ each is as follows:
Homeservers should periodically try again for the newer endpoints
because the application service may have been updated.

#### Unknown routes

If a request for an unsupported (or unknown) endpoint is received than the server
clokep marked this conversation as resolved.
Show resolved Hide resolved
must respond with 404 `M_UNRECOGNIZED` error.
clokep marked this conversation as resolved.
Show resolved Hide resolved

Similarly, a 405 `M_UNREOCGNIZED` error is used to denote an unsupported method
clokep marked this conversation as resolved.
Show resolved Hide resolved
to a known endpoint.

#### Pushing events

The application service API provides a transaction API for sending a
Expand Down
8 changes: 5 additions & 3 deletions content/client-server-api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ No resource was found for this request.
Too many requests have been sent in a short period of time. Wait a while
then try again.

`M_UNRECOGNIZED`
The server did not understand the request, this is expected to be returned with
clokep marked this conversation as resolved.
Show resolved Hide resolved
an 404 HTTP status code if the endpoint is not implemented or an 405 HTTP status
code if the endpoint is implemented, but the incorrect HTTP method is used.

`M_UNKNOWN`
An unknown error has occurred.

Expand All @@ -116,9 +121,6 @@ The following error codes are specific to certain endpoints.

<!-- TODO: move them to the endpoints that return them -->

`M_UNRECOGNIZED`
The server did not understand the request.

`M_UNAUTHORIZED`
The request was not correctly authorized. Usually due to login failures.

Expand Down
5 changes: 5 additions & 0 deletions content/identity-service-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ attempting to verify ownership of a given third party address.
The request contained an unrecognised value, such as an unknown token or
medium.

This is also used as the response if a server did not understand the request,
this is expected to be returned with an 404 HTTP status code if the endpoint is
clokep marked this conversation as resolved.
Show resolved Hide resolved
not implemented or an 405 HTTP status code if the endpoint is implemented, but
the incorrect HTTP method is used.

`M_THREEPID_IN_USE`
The third party identifier is already in use by another user. Typically
this error will have an additional `mxid` property to indicate who owns
Expand Down
10 changes: 10 additions & 0 deletions content/push-gateway-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ notification provider (e.g. APNS, GCM).
Mobile Device or Client
```

## API standards

### Unsupported endpoints

If a request for an unsupported (or unknown) endpoint is received than the server
must respond with 404 `M_UNRECOGNIZED` error.

Similarly, a 405 `M_UNREOCGNIZED` error is used to denote an unsupported method
to a known endpoint.

## Homeserver behaviour

This describes the format used by "HTTP" pushers to send notifications
Expand Down
8 changes: 8 additions & 0 deletions content/server-server-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ to be an IP address in which case SNI is not supported and should not be sent.
Servers are encouraged to make use of the [Certificate
Transparency](https://www.certificate-transparency.org/) project.

### Unsupported endpoints

If a request for an unsupported (or unknown) endpoint is received than the server
must respond with 404 `M_UNRECOGNIZED` error.

Similarly, a 405 `M_UNREOCGNIZED` error is used to denote an unsupported method
to a known endpoint.

## Server discovery

### Resolving server names
Expand Down