@@ -341,6 +341,89 @@ The following fields are returned in the JSON response body:
341341- ``total `` - Number of rooms.
342342
343343
344+ List media of an user
345+ ================================
346+ Gets a list of all local media that a specific ``user_id `` has created.
347+ The response is ordered by creation date descending and media ID descending.
348+ The newest media is on top.
349+
350+ The API is::
351+
352+ GET /_synapse/admin/v1/users/<user_id>/media
353+
354+ To use it, you will need to authenticate by providing an ``access_token `` for a
355+ server admin: see `README.rst <README.rst >`_.
356+
357+ A response body like the following is returned:
358+
359+ .. code :: json
360+
361+ {
362+ "media" : [
363+ {
364+ "created_ts" : 100400 ,
365+ "last_access_ts" : null ,
366+ "media_id" : " qXhyRzulkwLsNHTbpHreuEgo" ,
367+ "media_length" : 67 ,
368+ "media_type" : " image/png" ,
369+ "quarantined_by" : null ,
370+ "safe_from_quarantine" : false ,
371+ "upload_name" : " test1.png"
372+ },
373+ {
374+ "created_ts" : 200400 ,
375+ "last_access_ts" : null ,
376+ "media_id" : " FHfiSnzoINDatrXHQIXBtahw" ,
377+ "media_length" : 67 ,
378+ "media_type" : " image/png" ,
379+ "quarantined_by" : null ,
380+ "safe_from_quarantine" : false ,
381+ "upload_name" : " test2.png"
382+ }
383+ ],
384+ "next_token" : 3 ,
385+ "total" : 2
386+ }
387+
388+ To paginate, check for ``next_token `` and if present, call the endpoint again
389+ with ``from `` set to the value of ``next_token ``. This will return a new page.
390+
391+ If the endpoint does not return a ``next_token `` then there are no more
392+ reports to paginate through.
393+
394+ **Parameters **
395+
396+ The following parameters should be set in the URL:
397+
398+ - ``user_id `` - string - fully qualified: for example, ``@user:server.com ``.
399+ - ``limit ``: string representing a positive integer - Is optional but is used for pagination,
400+ denoting the maximum number of items to return in this call. Defaults to ``100 ``.
401+ - ``from ``: string representing a positive integer - Is optional but used for pagination,
402+ denoting the offset in the returned results. This should be treated as an opaque value and
403+ not explicitly set to anything other than the return value of ``next_token `` from a previous call.
404+ Defaults to ``0 ``.
405+
406+ **Response **
407+
408+ The following fields are returned in the JSON response body:
409+
410+ - ``media `` - An array of objects, each containing information about a media.
411+ Media objects contain the following fields:
412+
413+ - ``created_ts `` - integer - Timestamp when the content was uploaded in ms.
414+ - ``last_access_ts `` - integer - Timestamp when the content was last accessed in ms.
415+ - ``media_id `` - string - The id used to refer to the media.
416+ - ``media_length `` - integer - Length of the media in bytes.
417+ - ``media_type `` - string - The MIME-type of the media.
418+ - ``quarantined_by `` - string - The user ID that initiated the quarantine request
419+ for this media.
420+
421+ - ``safe_from_quarantine `` - bool - Status if this media is safe from quarantining.
422+ - ``upload_name `` - string - The name the media was uploaded with.
423+
424+ - ``next_token ``: integer - Indication for pagination. See above.
425+ - ``total `` - integer - Total number of media.
426+
344427User devices
345428============
346429
0 commit comments