Reports

GET /api/reports

Get reports.

Scope: reports:read

Minimum role: Moderator

Example requests:

  • without parameters:

GET /api/reports/ HTTP/1.1
  • with some query parameters:

GET /api/reports?page=1&order=desc&order_by=created_at  HTTP/1.1

Example responses:

  • returning at least one report:

HTTP/1.1 200 SUCCESS
Content-Type: application/json

  {
    "pagination": {
      "has_next": false,
      "has_prev": false,
      "page": 1,
      "pages": 1,
      "total": 1
    },
    "reports": [
      {
        "created_at": "Sun, 01 Dec 2024 18:17:30 GMT",
        "id": 1,
        "is_reported_user_warned": false,
        "note": "<REPORT NOTE>",
        "object_type": "user",
        "reported_by": {
          "created_at": "Sun, 01 Dec 2024 17:27:56 GMT",
          "email": "moderator@example.com",
          "followers": 0,
          "following": 0,
          "is_active": true,
          "nb_workouts": 0,
          "picture": false,
          "role": "moderator",
          "suspended_at": null,
          "username": "moderator"
        },
        "reported_comment": null,
        "reported_user": {
          "blocked": false,
          "created_at": "Sun, 01 Dec 2024 17:27:49 GMT",
          "email": "sam@example.com",
          "followers": 0,
          "following": 0,
          "follows": "false",
          "is_active": true,
          "is_followed_by": "false",
          "nb_workouts": 1,
          "picture": false,
          "role": "user",
          "suspended_at": null,
          "username": "Sam"
        },
        "reported_workout": null,
        "resolved": false,
        "resolved_at": null,
        "resolved_by": null,
        "updated_at": null
      }
    ],
    "status": "success"
  }
  • returning no reports

HTTP/1.1 200 OK
Content-Type: application/json

  {
    "pagination": {
      "has_next": false,
      "has_prev": false,
      "page": 1,
      "pages": 0,
      "total": 0
    },
    "reports": [],
    "status": "success"
  }
Query Parameters:
  • object_type (integer) – reported content type (comment, user or workout)

  • order (string) – sorting order: asc, desc (default: desc)

  • order_by (string) – sorting criteria: created_at or updated_at

  • page (integer) – page if using pagination (default: 1)

  • reporter (boolean) – reporter username

  • resolved (boolean) – filter on report status

Request Headers:
Status Codes:
  • 200 OKsuccess

  • 400 Bad Request

    • invalid payload

    • invalid 'order_by'

  • 401 Unauthorized

    • provide a valid auth token

    • signature expired, please log in again

    • invalid token, please log in again

GET /api/reports/(int: report_id)

Get report.

Scope: reports:read

Minimum role: Moderator

Example request:

GET /api/reports/1 HTTP/1.1

Example response:

HTTP/1.1 200 SUCCESS
Content-Type: application/json

  {
    "report": {
      "comments": [],
      "created_at": "Sun, 01 Dec 2024 18:17:30 GMT",
      "id": 1,
      "is_reported_user_warned": false,
      "note": "<REPORT NOTE>",
      "object_type": "user",
      "report_actions": [],
      "reported_by": {
        "created_at": "Sun, 01 Dec 2024 17:27:56 GMT",
        "email": "moderator@example.com",
        "followers": 0,
        "following": 0,
        "is_active": true,
        "nb_workouts": 0,
        "picture": false,
        "role": "moderator",
        "suspended_at": null,
        "username": "moderator"
      },
      "reported_comment": null,
      "reported_user": {
        "blocked": false,
        "created_at": "Sun, 01 Dec 2024 17:27:49 GMT",
        "email": "sam@example.com",
        "followers": 0,
        "following": 0,
        "follows": "false",
        "is_active": true,
        "is_followed_by": "false",
        "nb_workouts": 1,
        "picture": false,
        "role": "user",
        "suspended_at": null,
        "username": "Sam"
      },
      "reported_workout": null,
      "resolved": false,
      "resolved_at": null,
      "resolved_by": null,
      "updated_at": null
    },
    "status": "success"
  }
Request Headers:
Status Codes:
  • 200 OKsuccess

  • 401 Unauthorized

    • provide a valid auth token

    • signature expired, please log in again

    • invalid token, please log in again

  • 404 Not Found

    • report not found

GET /api/reports/unresolved

Get if unresolved reports exist.

Scope: reports:read

Minimum role: Moderator

Example request:

POST /api/reports/unresolved HTTP/1.1

Example response:

HTTP/1.1 201 SUCCESS
Content-Type: application/json

  {
    "status": "success",
    "unresolved": true
  }
Request Headers:
Status Codes:
  • 200 OKsuccess

  • 401 Unauthorized

    • provide a valid auth token

    • signature expired, please log in again

    • invalid token, please log in again

  • 403 Forbidden

    • you do not have permissions

POST /api/reports

Create a report.

Scope: reports:write

Example request:

POST /api/reports HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 201 CREATED
Content-Type: application/json
Request JSON Object:
  • note (string) – note describing report

  • object_id (string) – id of content reported

  • object_type (string) – type of content reported (comment, workout or user)

Request Headers:
Status Codes:
  • 201 Created – report created

  • 400 Bad Request

    • invalid payload

    • users can not report their own comment

    • users can not report their own profile

    • users can not report their own workout

  • 401 Unauthorized

    • provide a valid auth token

    • signature expired, please log in again

    • invalid token, please log in again

  • 403 Forbidden

    • you do not have permissions

    • you do not have permissions, your account is suspended

  • 404 Not Found

    • comment not found

    • user not found

    • workout not found

  • 500 Internal Server ErrorError during comment save.

PATCH /api/reports/(int: report_id)

Update report.

Scope: reports:write

Minimum role: Moderator

Example request:

PATCH /api/reports/1 HTTP/1.1

Example response (report on user profile):

HTTP/1.1 200 SUCCESS
Content-Type: application/json

  {
    "report": {
      "comments": [
        {
          "comment": "<REPORT COMMENT>",
          "created_at": "Sun, 01 Dec 2024 18:21:38 GMT",
          "id": 1,
          "report_id": 1,
          "user": {
            "created_at": "Sun, 01 Dec 2024 17:27:56 GMT",
            "email": "moderator@example.com",
            "followers": 0,
            "following": 0,
            "is_active": true,
            "nb_workouts": 0,
            "picture": false,
            "role": "moderator",
            "suspended_at": null,
            "username": "moderator"
          }
        }
      ],
      "created_at": "Sun, 01 Dec 2024 18:17:30 GMT",
      "id": 1,
      "is_reported_user_warned": false,
      "note": "<REPORT NOTE>",
      "object_type": "user",
      "report_actions": [],
      "reported_by": {
        "created_at": "Sun, 01 Dec 2024 17:27:56 GMT",
        "email": "moderator@example.com",
        "followers": 0,
        "following": 0,
        "is_active": true,
        "nb_workouts": 0,
        "picture": false,
        "role": "moderator",
        "suspended_at": null,
        "username": "moderator"
      },
      "reported_comment": null,
      "reported_user": {
        "blocked": false,
        "created_at": "Sun, 01 Dec 2024 17:27:49 GMT",
        "email": "sam@example.com",
        "followers": 0,
        "following": 0,
        "follows": "false",
        "is_active": true,
        "is_followed_by": "false",
        "nb_workouts": 1,
        "picture": false,
        "role": "user",
        "suspended_at": null,
        "username": "Sam"
      },
      "reported_workout": null,
      "resolved": false,
      "resolved_at": null,
      "resolved_by": null,
      "updated_at": "Sun, 01 Dec 2024 18:21:38 GMT"
    },
    "status": "success"
  }
Parameters:
  • report_id (string) – report id

Request JSON Object:
  • notes (string) – report comment (mandatory)

  • resolved (boolean) – report status

Request Headers:
Status Codes:
POST /api/reports/(int: report_id)/actions

Create report action.

Scope: reports:write

Minimum role: Moderator

Example request:

POST /api/reports/1/actions HTTP/1.1

Example response (report on user profile):

HTTP/1.1 201 SUCCESS
Content-Type: application/json

  {
    "report": {
      "comments": [
        {
          "comment": "<REPORT COMMENT>",
          "created_at": "Sun, 01 Dec 2024 18:21:38 GMT",
          "id": 1,
          "report_id": 1,
          "user": {
            "created_at": "Sun, 01 Dec 2024 17:27:56 GMT",
            "email": "moderator@example.com",
            "followers": 0,
            "following": 0,
            "is_active": true,
            "nb_workouts": 0,
            "picture": false,
            "role": "moderator",
            "suspended_at": null,
            "username": "moderator"
          }
        }
      ],
      "created_at": "Sun, 01 Dec 2024 18:17:30 GMT",
      "id": 1,
      "is_reported_user_warned": false,
      "note": "<REPORT NOTE>",
      "object_type": "user",
      "report_actions": [
        {
          "action_type": "user_warning",
          "appeal": null,
          "created_at": "Wed, 04 Dec 2024 09:12:25 GMT",
          "id": "Hv9KwVDtBHhyfvML7PHovq",
          "moderator": {
            "created_at": "Sun, 01 Dec 2024 17:27:56 GMT",
            "email": "moderator@example.com",
            "followers": 0,
            "following": 0,
            "is_active": true,
            "nb_workouts": 0,
            "picture": false,
            "role": "moderator",
            "suspended_at": null,
            "username": "moderator"
          },
          "reason": "<ACTION REASON>",
          "report_id": 1,
          "user": {
            "blocked": false,
            "created_at": "Sun, 01 Dec 2024 17:27:49 GMT",
            "email": "sam@example.com",
            "followers": 0,
            "following": 0,
            "follows": "false",
            "is_active": true,
            "is_followed_by": "false",
            "nb_workouts": 1,
            "picture": false,
            "role": "user",
            "suspended_at": null,
            "username": "Sam"
          }
        }
      ],
      "reported_by": {
        "created_at": "Sun, 01 Dec 2024 17:27:56 GMT",
        "email": "moderator@example.com",
        "followers": 0,
        "following": 0,
        "is_active": true,
        "nb_workouts": 0,
        "picture": false,
        "role": "moderator",
        "suspended_at": null,
        "username": "moderator"
      },
      "reported_comment": null,
      "reported_user": {
        "blocked": false,
        "created_at": "Sun, 01 Dec 2024 17:27:49 GMT",
        "email": "sam@example.com",
        "followers": 0,
        "following": 0,
        "follows": "false",
        "is_active": true,
        "is_followed_by": "false",
        "nb_workouts": 1,
        "picture": false,
        "role": "user",
        "suspended_at": null,
        "username": "Sam"
      },
      "reported_workout": null,
      "resolved": false,
      "resolved_at": null,
      "resolved_by": null,
      "updated_at": "Sun, 01 Dec 2024 18:21:38 GMT"
    },
    "status": "success"
  }
Parameters:
  • report_id (string) – report id

Request JSON Object:
  • action_type (string) – action type (expected value: user_suspension, user_unsuspension, user_warning, comment_suspension, comment_unsuspension, workout_suspension, workout_unsuspension)

  • comment_id (string) – id of comment affected by action (type: comment_suspension, comment_suspension)

  • reason (string) – text explaining the reason for the action

  • username (string) – username of user affected by action (type: user_suspension, user_unsuspension, user_warning)

  • workout_id (string) – id of workout affected by action (type: workout_suspension, workout_unsuspension)

Request Headers:
Status Codes:
PATCH /api/appeals/(string: appeal_id)

Process appeal.

Scope: users:write

Minimum role: Moderator

Example request:

POST /api/appeals/Z2Ze5qZrnMVmnDejPphASk HTTP/1.1

Example response (report on user profile):

HTTP/1.1 201 SUCCESS
Content-Type: application/json

  {
    "appeal": {
      "approved": true,
      "created_at": "Wed, 04 Dec 2024 09:29:18 GMT",
      "id": "Z2Ze5qZrnMVmnDejPphASk",
      "moderator": {
        "created_at": "Sun, 01 Dec 2024 17:27:56 GMT",
        "email": "moderator@example.com",
        "followers": 0,
        "following": 0,
        "is_active": true,
        "nb_workouts": 0,
        "picture": false,
        "role": "moderator",
        "suspended_at": null,
        "username": "moderator"
      },
      "reason": "<REASON>",
      "text": "<APPEAL TEXT>",
      "updated_at": "Wed, 04 Dec 2024 09:30:21 GMT",
      "user": {
        "blocked": false,
        "created_at": "Sun, 01 Dec 2024 17:27:49 GMT",
        "email": "sam@example.com",
        "followers": 0,
        "following": 0,
        "follows": "false",
        "is_active": true,
        "is_followed_by": "false",
        "nb_workouts": 1,
        "picture": false,
        "role": "user",
        "suspended_at": null,
        "username": "Sam"
      }
    },
    "status": "success"
  }
Parameters:
  • appeal_id (string) – appeal id

Request JSON Object:
  • approved (boolean) – true if appeal is approved, false if rejected

  • reason (string) – text explaining why the appeal was approved or rejected

Request Headers:
Status Codes: