2016-07-12 18:22:33 +02:00
# Copyright 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2015-05-29 15:31:05 +02:00
swagger : '2.0'
info :
2015-12-04 12:09:35 +01:00
title : "Matrix Client-Server Directory API"
2015-05-29 15:31:05 +02:00
version : "1.0.0"
2015-05-29 16:37:44 +02:00
host : localhost:8008
2015-05-29 15:31:05 +02:00
schemes :
- https
- http
2015-12-04 12:09:35 +01:00
basePath : /_matrix/client/%CLIENT_MAJOR_VERSION%/directory
2015-05-29 15:31:05 +02:00
consumes :
- application/json
produces :
- application/json
2015-05-29 16:18:09 +02:00
securityDefinitions :
2016-05-03 14:57:16 +02:00
$ref : definitions/security.yaml
2015-05-29 15:31:05 +02:00
paths :
"/room/{roomAlias}" :
put :
summary : Create a new mapping from room alias to room ID.
2017-08-03 01:19:34 +02:00
operationId : setRoomAlias
2015-05-29 16:18:09 +02:00
security :
- accessToken : [ ]
2015-05-29 15:31:05 +02:00
parameters :
- in : path
type : string
name : roomAlias
description : The room alias to set.
required : true
2015-11-26 16:03:39 +01:00
x-example : "#monkeys:matrix.org"
2015-05-29 15:31:05 +02:00
- in : body
name : roomInfo
description : Information about this room alias.
required : true
schema :
type : object
properties :
room_id :
type : string
description : The room ID to set.
2017-09-26 18:53:28 +02:00
example : {
2015-11-26 16:03:39 +01:00
"room_id": "!abnjk1jdasj98:capuchins.com"
}
2015-05-29 15:31:05 +02:00
responses :
200 :
description : The mapping was created.
2015-11-26 16:03:39 +01:00
examples :
2017-09-26 18:53:28 +02:00
application/json : {
}
2015-05-29 15:31:05 +02:00
schema :
2015-11-26 16:03:39 +01:00
type : object
2016-06-16 14:53:46 +02:00
409 :
description : A room alias with that name already exists.
examples :
2017-09-26 18:53:28 +02:00
application/json : {
2016-06-16 14:53:46 +02:00
"errcode": "M_UNKNOWN" ,
"error": "Room alias #monkeys:matrix.org already exists."
}
2015-12-07 13:45:13 +01:00
tags :
- Room directory
2015-05-29 15:31:05 +02:00
get :
summary : Get the room ID corresponding to this room alias.
2016-06-16 14:53:46 +02:00
description : |-
Requests that the server resolve a room alias to a room ID.
The server will use the federation API to resolve the alias if the
domain part of the alias does not correspond to the server's own
domain.
2017-08-03 01:19:34 +02:00
operationId : getRoomIdByAlias
2015-05-29 15:31:05 +02:00
parameters :
- in : path
type : string
name : roomAlias
description : The room alias.
required : true
2015-11-26 16:03:39 +01:00
x-example : "#monkeys:matrix.org"
2015-05-29 15:31:05 +02:00
responses :
200 :
description : The room ID and other information for this alias.
schema :
type : object
properties :
room_id :
type : string
description : The room ID for this room alias.
servers :
type : array
2017-07-27 18:43:49 +02:00
description : A list of servers that are aware of this room alias.
2015-05-29 15:31:05 +02:00
items :
type : string
2017-07-27 18:43:49 +02:00
description : A server which is aware of this room alias.
2015-11-26 16:03:39 +01:00
examples :
2017-09-26 18:53:28 +02:00
application/json : {
2015-11-26 16:03:39 +01:00
"room_id": "!abnjk1jdasj98:capuchins.com" ,
"servers": [
"capuchins.com" ,
"matrix.org" ,
"another.com"
]
}
2015-05-29 15:31:05 +02:00
404 :
description : There is no mapped room ID for this room alias.
2015-11-26 16:03:39 +01:00
examples :
2017-09-26 18:53:28 +02:00
application/json : {
2015-11-26 16:03:39 +01:00
"errcode": "M_NOT_FOUND" ,
2017-07-27 18:43:49 +02:00
"error": "Room alias #monkeys:matrix.org not found."
2015-11-26 16:03:39 +01:00
}
2015-12-07 13:45:13 +01:00
tags :
- Room directory
2015-05-29 15:31:05 +02:00
delete :
summary : Remove a mapping of room alias to room ID.
2015-11-26 16:03:39 +01:00
description : |-
Remove a mapping of room alias to room ID.
Servers may choose to implement additional access control checks here, for instance that room aliases can only be deleted by their creator or a server administrator.
2017-08-03 01:19:34 +02:00
operationId : deleteRoomAlias
2015-05-29 16:18:09 +02:00
security :
- accessToken : [ ]
2015-05-29 15:31:05 +02:00
parameters :
- in : path
type : string
name : roomAlias
description : The room alias to remove.
required : true
2015-11-26 16:03:39 +01:00
x-example : "#monkeys:matrix.org"
2015-05-29 15:31:05 +02:00
responses :
200 :
2015-11-26 16:03:39 +01:00
description : The mapping was deleted.
examples :
2017-09-26 18:53:28 +02:00
application/json : {
}
2015-05-29 15:31:05 +02:00
schema :
2015-11-26 16:03:39 +01:00
type : object
2015-12-07 13:45:13 +01:00
tags :
- Room directory