Skip to content

Commit cc1e496

Browse files
authored
Merge pull request #1629 from turt2live/travis/as/route-versions
Version all appservice endpoints and provide a fallback
2 parents 20c9829 + be5c566 commit cc1e496

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

api/application-service/protocols.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ host: localhost:8008
1919
schemes:
2020
- https
2121
- http
22-
basePath: "/"
22+
basePath: /_matrix/app/v1
2323
consumes:
2424
- application/json
2525
produces:
2626
- application/json
2727
securityDefinitions:
2828
$ref: definitions/security.yaml
2929
paths:
30-
"/_matrix/app/unstable/thirdparty/protocol/{protocol}":
30+
"/thirdparty/protocol/{protocol}":
3131
get:
3232
summary: Retrieve metadata about a specific protocol that the application service supports.
3333
description: |-
@@ -76,7 +76,7 @@ paths:
7676
}
7777
schema:
7878
$ref: ../client-server/definitions/errors/error.yaml
79-
"/_matrix/app/unstable/thirdparty/user/{protocol}":
79+
"/thirdparty/user/{protocol}":
8080
get:
8181
summary: Retrieve the Matrix User ID of a corresponding third party user.
8282
description: |-
@@ -131,7 +131,7 @@ paths:
131131
}
132132
schema:
133133
$ref: ../client-server/definitions/errors/error.yaml
134-
"/_matrix/app/unstable/thirdparty/location/{protocol}":
134+
"/thirdparty/location/{protocol}":
135135
get:
136136
summary: Retrieve Matrix-side portal rooms leading to a third party location.
137137
description: |-
@@ -184,7 +184,7 @@ paths:
184184
}
185185
schema:
186186
$ref: ../client-server/definitions/errors/error.yaml
187-
"/_matrix/app/unstable/thirdparty/location":
187+
"/thirdparty/location":
188188
get:
189189
summary: Reverse-lookup third party locations given a Matrix room alias.
190190
description: |-
@@ -231,7 +231,7 @@ paths:
231231
}
232232
schema:
233233
$ref: ../client-server/definitions/errors/error.yaml
234-
"/_matrix/app/unstable/thirdparty/user":
234+
"/thirdparty/user":
235235
get:
236236
summary: Reverse-lookup third party users given a Matrix User ID.
237237
description: |-

api/application-service/query_room.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ host: localhost:8008
2020
schemes:
2121
- https
2222
- http
23-
basePath: "/"
23+
basePath: /_matrix/app/v1
2424
consumes:
2525
- application/json
2626
produces:

api/application-service/query_user.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ host: localhost:8008
2020
schemes:
2121
- https
2222
- http
23-
basePath: "/"
23+
basePath: /_matrix/app/v1
2424
consumes:
2525
- application/json
2626
produces:

api/application-service/transactions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ host: localhost:8008
2020
schemes:
2121
- https
2222
- http
23-
basePath: "/"
23+
basePath: /_matrix/app/v1
2424
produces:
2525
- application/json
2626
securityDefinitions:

specification/application_service_api.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,34 @@ An example registration file for an IRC-bridging application service is below:
184184
Homeserver -> Application Service API
185185
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186186

187+
Legacy routes
188+
+++++++++++++
189+
190+
Previous drafts of the application service specification had a mix of endpoints
191+
that have been used in the wild for a significant amount of time. The application
192+
service specification now defines a version on all endpoints to be more compatible
193+
with the rest of the Matrix specification and the future.
194+
195+
Homeservers should attempt to use the specified endpoints first when communicating
196+
with application services. However, if the application service receives an http status
197+
code that does not indicate success (ie: 404, 500, 501, etc) then the homeserver
198+
should fall back to the older endpoints for the application service.
199+
200+
The older endpoints have the exact same request body and response format, they
201+
just belong at a different path. The equivalent path for each is as follows:
202+
203+
* ``/_matrix/app/v1/transactions/{txnId}`` becomes ``/transactions/{txnId}``
204+
* ``/_matrix/app/v1/users/{userId}`` becomes ``/users/{userId}``
205+
* ``/_matrix/app/v1/rooms/{roomAlias}`` becomes ``/rooms/{roomAlias}``
206+
* ``/_matrix/app/v1/thirdparty/protocol/{protocol}`` becomes ``/_matrix/app/unstable/thirdparty/protocol/{protocol}``
207+
* ``/_matrix/app/v1/thirdparty/user/{user}`` becomes ``/_matrix/app/unstable/thirdparty/user/{user}``
208+
* ``/_matrix/app/v1/thirdparty/location/{location}`` becomes ``/_matrix/app/unstable/thirdparty/location/{location}``
209+
* ``/_matrix/app/v1/thirdparty/user`` becomes ``/_matrix/app/unstable/thirdparty/user``
210+
* ``/_matrix/app/v1/thirdparty/location`` becomes ``/_matrix/app/unstable/thirdparty/location``
211+
212+
Homeservers should periodically try again for the newer endpoints because the
213+
application service may have been updated.
214+
187215
Pushing events
188216
++++++++++++++
189217

0 commit comments

Comments
 (0)