matrix-spec/api/client-server/directory.yaml

137 lines
3.9 KiB
YAML
Raw Normal View History

2015-05-29 15:31:05 +02:00
swagger: '2.0'
info:
title: "Matrix Client-Server Directory API"
2015-05-29 15:31:05 +02:00
version: "1.0.0"
host: localhost:8008
2015-05-29 15:31:05 +02:00
schemes:
- https
- http
basePath: /_matrix/client/%CLIENT_MAJOR_VERSION%/directory
2015-05-29 15:31:05 +02:00
consumes:
- application/json
produces:
- application/json
securityDefinitions:
$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.
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.
2015-11-26 16:03:39 +01:00
example: |-
{
"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:
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:
application/json: |-
{
"errcode": "M_UNKNOWN",
"error": "Room alias #monkeys:matrix.org already exists."
}
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.
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
description: A list of servers that are aware of this room ID.
items:
type: string
description: A server which is aware of this room ID.
2015-11-26 16:03:39 +01:00
examples:
application/json: |-
{
"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:
application/json: |-
{
"errcode": "M_NOT_FOUND",
"error": "Room ID !abnjk1jdasj98:capuchins.com not found."
}
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.
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:
application/json: |-
{}
2015-05-29 15:31:05 +02:00
schema:
2015-11-26 16:03:39 +01:00
type: object
tags:
- Room directory