mirror of
https://github.com/element-hq/synapse.git
synced 2025-03-28 18:38:31 +00:00
deploy: bb5b47b62a
This commit is contained in:
parent
45fcf7532c
commit
d82a3a2909
4 changed files with 256 additions and 2 deletions
develop
|
@ -504,6 +504,133 @@ If the room does not define a type, the value will be <code>null</code>.</li>
|
|||
]
|
||||
}
|
||||
</code></pre>
|
||||
<h1 id="room-messages-api"><a class="header" href="#room-messages-api">Room Messages API</a></h1>
|
||||
<p>The Room Messages admin API allows server admins to get all messages
|
||||
sent to a room in a given timeframe. There are various parameters available
|
||||
that allow for filtering and ordering the returned list. This API supports pagination.</p>
|
||||
<p>To use it, you will need to authenticate by providing an <code>access_token</code>
|
||||
for a server admin: see <a href="../usage/administration/admin_api">Admin API</a>.</p>
|
||||
<p>This endpoint mirrors the <a href="https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3roomsroomidmessages">Matrix Spec defined Messages API</a>.</p>
|
||||
<p>The API is:</p>
|
||||
<pre><code>GET /_synapse/admin/v1/rooms/<room_id>/messages
|
||||
</code></pre>
|
||||
<p><strong>Parameters</strong></p>
|
||||
<p>The following path parameters are required:</p>
|
||||
<ul>
|
||||
<li><code>room_id</code> - The ID of the room you wish you fetch messages from.</li>
|
||||
</ul>
|
||||
<p>The following query parameters are available:</p>
|
||||
<ul>
|
||||
<li><code>from</code> (required) - The token to start returning events from. This token can be obtained from a prev_batch
|
||||
or next_batch token returned by the /sync endpoint, or from an end token returned by a previous request to this endpoint.</li>
|
||||
<li><code>to</code> - The token to spot returning events at.</li>
|
||||
<li><code>limit</code> - The maximum number of events to return. Defaults to <code>10</code>.</li>
|
||||
<li><code>filter</code> - A JSON RoomEventFilter to filter returned events with.</li>
|
||||
<li><code>dir</code> - The direction to return events from. Either <code>f</code> for forwards or <code>b</code> for backwards. Setting
|
||||
this value to <code>b</code> will reverse the above sort order. Defaults to <code>f</code>.</li>
|
||||
</ul>
|
||||
<p><strong>Response</strong></p>
|
||||
<p>The following fields are possible in the JSON response body:</p>
|
||||
<ul>
|
||||
<li><code>chunk</code> - A list of room events. The order depends on the dir parameter.
|
||||
Note that an empty chunk does not necessarily imply that no more events are available. Clients should continue to paginate until no end property is returned.</li>
|
||||
<li><code>end</code> - A token corresponding to the end of chunk. This token can be passed back to this endpoint to request further events.
|
||||
If no further events are available, this property is omitted from the response.</li>
|
||||
<li><code>start</code> - A token corresponding to the start of chunk.</li>
|
||||
<li><code>state</code> - A list of state events relevant to showing the chunk.</li>
|
||||
</ul>
|
||||
<p><strong>Example</strong></p>
|
||||
<p>For more details on each chunk, read <a href="https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3roomsroomidmessages">the Matrix specification</a>.</p>
|
||||
<pre><code class="language-json">{
|
||||
"chunk": [
|
||||
{
|
||||
"content": {
|
||||
"body": "This is an example text message",
|
||||
"format": "org.matrix.custom.html",
|
||||
"formatted_body": "<b>This is an example text message</b>",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"event_id": "$143273582443PhrSn:example.org",
|
||||
"origin_server_ts": 1432735824653,
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"sender": "@example:example.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 1234
|
||||
}
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"name": "The room name"
|
||||
},
|
||||
"event_id": "$143273582443PhrSn:example.org",
|
||||
"origin_server_ts": 1432735824653,
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"sender": "@example:example.org",
|
||||
"state_key": "",
|
||||
"type": "m.room.name",
|
||||
"unsigned": {
|
||||
"age": 1234
|
||||
}
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"body": "Gangnam Style",
|
||||
"info": {
|
||||
"duration": 2140786,
|
||||
"h": 320,
|
||||
"mimetype": "video/mp4",
|
||||
"size": 1563685,
|
||||
"thumbnail_info": {
|
||||
"h": 300,
|
||||
"mimetype": "image/jpeg",
|
||||
"size": 46144,
|
||||
"w": 300
|
||||
},
|
||||
"thumbnail_url": "mxc://example.org/FHyPlCeYUSFFxlgbQYZmoEoe",
|
||||
"w": 480
|
||||
},
|
||||
"msgtype": "m.video",
|
||||
"url": "mxc://example.org/a526eYUSFFxlgbQYZmo442"
|
||||
},
|
||||
"event_id": "$143273582443PhrSn:example.org",
|
||||
"origin_server_ts": 1432735824653,
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"sender": "@example:example.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 1234
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": "t47409-4357353_219380_26003_2265",
|
||||
"start": "t47429-4392820_219380_26003_2265"
|
||||
}
|
||||
</code></pre>
|
||||
<h1 id="room-timestamp-to-event-api"><a class="header" href="#room-timestamp-to-event-api">Room Timestamp to Event API</a></h1>
|
||||
<p>The Room Timestamp to Event API endpoint fetches the <code>event_id</code> of the closest event to the given
|
||||
timestamp (<code>ts</code> query parameter) in the given direction (<code>dir</code> query parameter).</p>
|
||||
<p>Useful for cases like jump to date so you can start paginating messages from
|
||||
a given date in the archive.</p>
|
||||
<p>The API is:</p>
|
||||
<pre><code> GET /_synapse/admin/v1/rooms/<room_id>/timestamp_to_event
|
||||
</code></pre>
|
||||
<p><strong>Parameters</strong></p>
|
||||
<p>The following path parameters are required:</p>
|
||||
<ul>
|
||||
<li><code>room_id</code> - The ID of the room you wish to check.</li>
|
||||
</ul>
|
||||
<p>The following query parameters are available:</p>
|
||||
<ul>
|
||||
<li><code>ts</code> - a timestamp in milliseconds where we will find the closest event in
|
||||
the given direction.</li>
|
||||
<li><code>dir</code> - can be <code>f</code> or <code>b</code> to indicate forwards and backwards in time from the
|
||||
given timestamp. Defaults to <code>f</code>.</li>
|
||||
</ul>
|
||||
<p><strong>Response</strong></p>
|
||||
<ul>
|
||||
<li><code>event_id</code> - converted from timestamp</li>
|
||||
</ul>
|
||||
<h1 id="block-room-api"><a class="header" href="#block-room-api">Block Room API</a></h1>
|
||||
<p>The Block Room admin API allows server admins to block and unblock rooms,
|
||||
and query to see if a given room is blocked.
|
||||
|
|
|
@ -11571,6 +11571,133 @@ If the room does not define a type, the value will be <code>null</code>.</li>
|
|||
]
|
||||
}
|
||||
</code></pre>
|
||||
<h1 id="room-messages-api"><a class="header" href="#room-messages-api">Room Messages API</a></h1>
|
||||
<p>The Room Messages admin API allows server admins to get all messages
|
||||
sent to a room in a given timeframe. There are various parameters available
|
||||
that allow for filtering and ordering the returned list. This API supports pagination.</p>
|
||||
<p>To use it, you will need to authenticate by providing an <code>access_token</code>
|
||||
for a server admin: see <a href="admin_api/../usage/administration/admin_api">Admin API</a>.</p>
|
||||
<p>This endpoint mirrors the <a href="https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3roomsroomidmessages">Matrix Spec defined Messages API</a>.</p>
|
||||
<p>The API is:</p>
|
||||
<pre><code>GET /_synapse/admin/v1/rooms/<room_id>/messages
|
||||
</code></pre>
|
||||
<p><strong>Parameters</strong></p>
|
||||
<p>The following path parameters are required:</p>
|
||||
<ul>
|
||||
<li><code>room_id</code> - The ID of the room you wish you fetch messages from.</li>
|
||||
</ul>
|
||||
<p>The following query parameters are available:</p>
|
||||
<ul>
|
||||
<li><code>from</code> (required) - The token to start returning events from. This token can be obtained from a prev_batch
|
||||
or next_batch token returned by the /sync endpoint, or from an end token returned by a previous request to this endpoint.</li>
|
||||
<li><code>to</code> - The token to spot returning events at.</li>
|
||||
<li><code>limit</code> - The maximum number of events to return. Defaults to <code>10</code>.</li>
|
||||
<li><code>filter</code> - A JSON RoomEventFilter to filter returned events with.</li>
|
||||
<li><code>dir</code> - The direction to return events from. Either <code>f</code> for forwards or <code>b</code> for backwards. Setting
|
||||
this value to <code>b</code> will reverse the above sort order. Defaults to <code>f</code>.</li>
|
||||
</ul>
|
||||
<p><strong>Response</strong></p>
|
||||
<p>The following fields are possible in the JSON response body:</p>
|
||||
<ul>
|
||||
<li><code>chunk</code> - A list of room events. The order depends on the dir parameter.
|
||||
Note that an empty chunk does not necessarily imply that no more events are available. Clients should continue to paginate until no end property is returned.</li>
|
||||
<li><code>end</code> - A token corresponding to the end of chunk. This token can be passed back to this endpoint to request further events.
|
||||
If no further events are available, this property is omitted from the response.</li>
|
||||
<li><code>start</code> - A token corresponding to the start of chunk.</li>
|
||||
<li><code>state</code> - A list of state events relevant to showing the chunk.</li>
|
||||
</ul>
|
||||
<p><strong>Example</strong></p>
|
||||
<p>For more details on each chunk, read <a href="https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3roomsroomidmessages">the Matrix specification</a>.</p>
|
||||
<pre><code class="language-json">{
|
||||
"chunk": [
|
||||
{
|
||||
"content": {
|
||||
"body": "This is an example text message",
|
||||
"format": "org.matrix.custom.html",
|
||||
"formatted_body": "<b>This is an example text message</b>",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"event_id": "$143273582443PhrSn:example.org",
|
||||
"origin_server_ts": 1432735824653,
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"sender": "@example:example.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 1234
|
||||
}
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"name": "The room name"
|
||||
},
|
||||
"event_id": "$143273582443PhrSn:example.org",
|
||||
"origin_server_ts": 1432735824653,
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"sender": "@example:example.org",
|
||||
"state_key": "",
|
||||
"type": "m.room.name",
|
||||
"unsigned": {
|
||||
"age": 1234
|
||||
}
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"body": "Gangnam Style",
|
||||
"info": {
|
||||
"duration": 2140786,
|
||||
"h": 320,
|
||||
"mimetype": "video/mp4",
|
||||
"size": 1563685,
|
||||
"thumbnail_info": {
|
||||
"h": 300,
|
||||
"mimetype": "image/jpeg",
|
||||
"size": 46144,
|
||||
"w": 300
|
||||
},
|
||||
"thumbnail_url": "mxc://example.org/FHyPlCeYUSFFxlgbQYZmoEoe",
|
||||
"w": 480
|
||||
},
|
||||
"msgtype": "m.video",
|
||||
"url": "mxc://example.org/a526eYUSFFxlgbQYZmo442"
|
||||
},
|
||||
"event_id": "$143273582443PhrSn:example.org",
|
||||
"origin_server_ts": 1432735824653,
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"sender": "@example:example.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 1234
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": "t47409-4357353_219380_26003_2265",
|
||||
"start": "t47429-4392820_219380_26003_2265"
|
||||
}
|
||||
</code></pre>
|
||||
<h1 id="room-timestamp-to-event-api"><a class="header" href="#room-timestamp-to-event-api">Room Timestamp to Event API</a></h1>
|
||||
<p>The Room Timestamp to Event API endpoint fetches the <code>event_id</code> of the closest event to the given
|
||||
timestamp (<code>ts</code> query parameter) in the given direction (<code>dir</code> query parameter).</p>
|
||||
<p>Useful for cases like jump to date so you can start paginating messages from
|
||||
a given date in the archive.</p>
|
||||
<p>The API is:</p>
|
||||
<pre><code> GET /_synapse/admin/v1/rooms/<room_id>/timestamp_to_event
|
||||
</code></pre>
|
||||
<p><strong>Parameters</strong></p>
|
||||
<p>The following path parameters are required:</p>
|
||||
<ul>
|
||||
<li><code>room_id</code> - The ID of the room you wish to check.</li>
|
||||
</ul>
|
||||
<p>The following query parameters are available:</p>
|
||||
<ul>
|
||||
<li><code>ts</code> - a timestamp in milliseconds where we will find the closest event in
|
||||
the given direction.</li>
|
||||
<li><code>dir</code> - can be <code>f</code> or <code>b</code> to indicate forwards and backwards in time from the
|
||||
given timestamp. Defaults to <code>f</code>.</li>
|
||||
</ul>
|
||||
<p><strong>Response</strong></p>
|
||||
<ul>
|
||||
<li><code>event_id</code> - converted from timestamp</li>
|
||||
</ul>
|
||||
<h1 id="block-room-api"><a class="header" href="#block-room-api">Block Room API</a></h1>
|
||||
<p>The Block Room admin API allows server admins to block and unblock rooms,
|
||||
and query to see if a given room is blocked.
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue