User Comment APIs

1. Overview

This page contains the APIs that are used for managing comments left by admins on user accounts.

2. Add a Comment to a User

This API is used to add a User Comment to a User’s account. User Comments are used to allow administrators and moderators the ability to take notes on Users.

2.1. Request

Add a User Comment

URI

POST /api/user/comment

Table 1. Request Body

userComment.comment [String] Required

The text of the User Comment.

userComment.commenterId [UUID] Required

The Id of the User that wrote the User Comment.

userComment.userId [UUID] Required

The Id of the User that the User Comment was written for.

Example Request JSON
{
  "userComment": {
    "comment": "Not sure if this user is violating any rules or not.",
    "commenterId": "00000000-0000-0000-0000-000000000002",
    "userId": "00000000-0000-0000-0000-000000000003"
  }
}

2.2. Response

The response for this API contain the User Comment that was added to the User’s account.

Table 2. Response Codes
Code Description

200

The request was successful. The response will contain a JSON body.

400

The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors.

401

You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.

500

There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty.

503

The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body.

Table 3. Response Body

userComment.comment [String]

The text of the User Comment.

userComment.commenterId [UUID]

The Id of the User that wrote the User Comment.

userComment.createInstant [Long]

The instant when the comment was written.

userComment.id [UUID]

The Id of the User Comment.

userComment.userId [UUID]

The Id of the User that the User Comment was written for.

Example Response JSON
{
  "userComment": {
    "comment": "Not sure if this user is violating any rules or not.",
    "commenterId": "00000000-0000-0000-0000-000000000002",
    "createInstant": 1471786483322,
    "id": "00000000-0000-0000-0000-000000000042",
    "userId": "00000000-0000-0000-0000-000000000003"
  }
}

3. Retrieve a User’s Comments

This API is used to retrieve all of the User Comments on a User’s account. User Comments are used to allow administrators and moderators the ability to take notes on Users.

3.1. Request

Retrieve all Comments for a User by Id

URI

GET /api/user/comment/{userId}

Table 4. Request Parameters

userId [UUID] Required

The Id of the User to retrieve the User Comments for.

3.2. Response

The response for this API contains all of the User Comments for the User.

Table 5. Response Codes
Code Description

200

The request was successful. The response will contain a JSON body.

400

The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors.

401

You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.

404

The object you requested doesn’t exist. The response will be empty.

500

There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty.

503

The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body.

Table 6. Response Body

userComments [Array]

The list of User Comment objects.

userComments[x].comment [String]

The text of the User Comment.

userComments[x].commenterId [UUID]

The Id of the User that wrote the User Comment.

userComments[x].createInstant [Long]

The instant when the comment was written.

userComments[x].id [UUID]

The Id of the User Comment.

userComments[x].userId [UUID]

The Id of the User that the User Comment was written for.

Example Response JSON
{
  "userComments": [
    {
      "comment": "Not sure if this user is violating any rules or not.",
      "commenterId": "00000000-0000-0000-0000-000000000002",
      "createInstant": 1471786483322,
      "id": "00000000-0000-0000-0000-000000000042",
      "userId": "00000000-0000-0000-0000-000000000003"
    }
  ]
}