Skip to content

Latest commit

 

History

History
110 lines (91 loc) · 3.75 KB

File metadata and controls

110 lines (91 loc) · 3.75 KB

Get Reported Messages

Retrieves all the reported messages grouped by users. It supports the #pagination parameters.

{% hint style="info" %} It requires the view-moderation-console permission. {% endhint %}

URL Requires Auth HTTP Method
/api/v1/moderation.reportsByUsers yes GET

Headers

ArgumentExampleRequiredDescription
X-User-Idmyuser-nameRequiredThe authenticated user ID.
X-Auth-Tokenmyauth-tokenRequiredAuth token.

Query Parameter

ArgumentExampleRequiredDescription
oldest2021-09-30T09:33:15.621ZOptionalIt represents the oldest point in time for which you want to retrieve moderation reports
latest2023-08-30T09:33:15.621ZOptionalIt represents the oldest point in time for which you want to retrieve moderation reports

Example Call

curl --location 'http://localhost:3000/api/v1/moderation.reportsByUsers' \
--header 'x-auth-token: aEO8Hw3zorBFQtAEYsNPnr67Li9-lY5kX1foen8UiiS' \
--header 'x-user-id: rbAXPnMktTFbNpwtJ' \
--data ''

Example Result

Success

{
    "reports": [
        {
            "rooms": [
                {
                    "_id": "6423ce62c29657e5b3ba2675rbAXPnMktTFbNpwtJ",
                    "t": "d",
                    "federated": true
                }
            ],
            "count": 1,
            "message": "hi",
            "msgId": "tDNLALSFk2LET2JZH",
            "ts": "2023-08-30T09:38:38.792Z",
            "username": "funke.olasupo",
            "name": "Funke Olasupo",
            "userId": "rbAXPnMktTFbNpwtJ",
            "isUserDeleted": false
        },
        {
            "rooms": [
                {
                    "_id": "5fRTXMt7DMJbpPJfhrbAXPnMktTFbNpwtJ",
                    "t": "d"
                }
            ],
            "count": 2,
            "message": "himm",
            "msgId": "xY8cN7yuPQfBgJ9xz",
            "ts": "2023-08-30T09:33:15.621Z",
            "username": "test.funke",
            "name": "TestFunke",
            "userId": "5fRTXMt7DMJbpPJfh",
            "isUserDeleted": false
        }
    ],
    "count": 2,
    "offset": 0,
    "total": 3,
    "success": true
}

Error

Any of the following errors can occur on the endpoint.

  • Authorization: Requires an authentication token for the request to be made.
  • Invalid UserId: Occurs when the userId is invalid or does not belong to any user in the workspace.
  • No Permission: Occurs when the authenticated user doesn't have the view-moderation-console permission.

{% tabs %} {% tab title="Authorization" %}

{
    "status": "error",
    "message": "You must be logged in to do this."
}

{% endtab %}

{% tab title="No Permission" %}

{
    "success": false,
    "error": "User does not have the permissions required for this action [error-unauthorized]"
}

{% endtab %} {% endtabs %}

Change Log

Version Description
6.2.0 Added