User Comments

Overview

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

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.

Request

API Key Authentication
Add a User Comment
POST /api/user/comment

Request Headers

X-FusionAuth-TenantIdString

The unique Id of the tenant used to scope this API request.

The tenant Id is not required on this request even when more than one tenant has been configured because the tenant can be identified based upon the request parameters or it is otherwise not required.

Specify a tenant Id on this request when you want to ensure the request is scoped to a specific tenant. The tenant Id may be provided through this header or by using a tenant locked API key to achieve the same result.

See Making an API request using a Tenant Id for additional information.

Request Body

userComment.commentStringrequired

The text of the User Comment.

userComment.commenterIdUUIDrequired

The Id of the User that wrote the User Comment.

userComment.userIdUUIDrequired

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"
  }
}

Response

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

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. This status will also be returned if a paid FusionAuth license is required and is not present.
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.

Response Body

userComment.commentString

The text of the User Comment.

userComment.commenterIdUUID

The Id of the User that wrote the User Comment.

userComment.createInstantLongDEPRECATED

The instant when the comment was written. This was deprecated in 1.18.0. Use insertInstant instead.

userComment.insertInstantLong

The instant when the comment was written.

userComment.idUUID

The Id of the User Comment.

userComment.userIdUUID

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",
    "id": "00000000-0000-0000-0000-000000000042",
    "insertInstant": 1471786483322,
    "userId": "00000000-0000-0000-0000-000000000003"
  }
}

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.

Request

API Key Authentication
Retrieve all Comments for a User by Id
GET /api/user/comment/{userId}

Request Headers

X-FusionAuth-TenantIdString

The unique Id of the tenant used to scope this API request.

The tenant Id is not required on this request even when more than one tenant has been configured because the tenant can be identified based upon the request parameters or it is otherwise not required.

Specify a tenant Id on this request when you want to ensure the request is scoped to a specific tenant. The tenant Id may be provided through this header or by using a tenant locked API key to achieve the same result.

See Making an API request using a Tenant Id for additional information.

Request Parameters

userIdUUIDrequired

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

Response

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

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. This status will also be returned if a paid FusionAuth license is required and is not present.
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.

Response Body

userCommentsArray

The list of User Comment objects.

userComments[x].commentString

The text of the User Comment.

userComments[x].commenterIdUUID

The Id of the User that wrote the User Comment.

userComments[x].createInstantLongDEPRECATED

The instant when the comment was written. This was deprecated in 1.18.0. Use insertInstant instead.

userComments[x].idUUID

The Id of the User Comment.

userComments[x].insertInstantLong

The instant when the comment was written.

userComments[x].userIdUUID

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",
      "id": "00000000-0000-0000-0000-000000000042",
      "insertInstant": 1471786483322,
      "userId": "00000000-0000-0000-0000-000000000003"
    }
  ]
}

Search for User Comments

This API has been available since 1.45.0

This API is used to search for User Comments and may be called using the GET or POST HTTP methods. Examples of each are provided below. The POST method is provided to allow for a richer request object without worrying about exceeding the maximum length of a URL. Calling this API with either the GET or POST HTTP method will provide the same search results given the same query parameters.

Request

API Key Authentication
Search for User Comments
GET /api/user/comment/search?comment={comment}

Request Headers

X-FusionAuth-TenantIdString

The unique Id of the tenant used to scope this API request.

The tenant Id is not required on this request even when more than one tenant has been configured because the tenant can be identified based upon the request parameters or it is otherwise not required.

Specify a tenant Id on this request when you want to ensure the request is scoped to a specific tenant. The tenant Id may be provided through this header or by using a tenant locked API key to achieve the same result.

See Making an API request using a Tenant Id for additional information.

Request Parameters

commentString

The case-insensitive string to search for in the User Comment text. This can contain wildcards using the asterisk character (*). If no wildcards are present, the search criteria will be interpreted as *value*.

commenterIdUUID

Restricts the results to User Comments created by the given User.

numberOfResultsIntegerDefaults to 25

The number of results to return from the search.

orderByStringDefaults to name ASC

The field to order the search results as well as an order direction.

The possible values are:

  • comment - the User Comment text
  • commenterId - the unique Id of the User who created the User Comment
  • id - the unique Id of the User Comment
  • insertInstant - the instant when the User Comment was created
  • tenantId -the unique Id of the Tenant to which the User Comment belongs
  • userId - the unique Id of the User to which the User Comment belongs

The order direction is optional. Possible values of the order direction are ASC or DESC. If omitted, the default sort order is ASC.

For example, to order the results by the insert instant in a descending order, use insertInstant DESC.

startRowIntegerDefaults to 0

The offset into the total results. In order to paginate the results, increment this value by the numberOfResults for subsequent requests.

For example, if the total search results are greater than the page size designated by numberOfResults , set this value to 25 to retrieve results 26-50, assuming the default page size.

tenantIdUUID

Restricts the results to User Comments belonging to the given Tenant. This parameter will be overridden if the request contains an X-FusionAuth-TenantId header, or if the supplied API key is scoped to a specific Tenant.

userIdUUID

Restricts the results to User Comments belonging to the given User.

API Key Authentication
Search for User Comments
POST /api/user/comment/search

Request Headers

X-FusionAuth-TenantIdString

The unique Id of the tenant used to scope this API request.

The tenant Id is not required on this request even when more than one tenant has been configured because the tenant can be identified based upon the request parameters or it is otherwise not required.

Specify a tenant Id on this request when you want to ensure the request is scoped to a specific tenant. The tenant Id may be provided through this header or by using a tenant locked API key to achieve the same result.

See Making an API request using a Tenant Id for additional information.

When calling the API using a POST request you will send the search criteria in a JSON request body.

Request Body

search.commentString

The case-insensitive string to search for in the User Comment text. This can contain wildcards using the asterisk character (*). If no wildcards are present, the search criteria will be interpreted as *value*.

search.commenterIdUUID

Restricts the results to User Comments created by the given User.

search.numberOfResultsIntegerDefaults to 25

The number of results to return from the search.

search.orderByStringDefaults to name ASC

The field to order the search results as well as an order direction.

The possible values are:

  • comment - the User Comment text
  • commenterId - the unique Id of the User who created the User Comment
  • id - the unique Id of the User Comment
  • insertInstant - the instant when the User Comment was created
  • tenantId -the unique Id of the Tenant to which the User Comment belongs
  • userId - the unique Id of the User to which the User Comment belongs

The order direction is optional. Possible values of the order direction are ASC or DESC. If omitted, the default sort order is ASC.

For example, to order the results by the insert instant in a descending order, use insertInstant DESC.

search.startRowIntegerDefaults to 0

The offset into the total results. In order to paginate the results, increment this value by the numberOfResults for subsequent requests.

For example, if the total search results are greater than the page size designated by numberOfResults , set this value to 25 to retrieve results 26-50, assuming the default page size.

search.tenantIdUUID

Restricts the results to User Comments belonging to the given Tenant. This parameter will be overridden if the request contains an X-FusionAuth-TenantId header, or if the supplied API key is scoped to a specific Tenant.

search.userIdUUID

Restricts the results to User Comments belonging to the given User.

Example Request JSON

{
  "search": {
    "comment": "violating",
    "commenterId": "00000000-0000-0000-0000-000000000002",
    "numberOfResults": 25,
    "orderBy": "insertInstant",
    "startRow": 0,
    "tenantId": "00000000-0000-0005-0000-000000000001",
    "userId": "00000000-0000-0000-0000-000000000003"
  }
}

Response

The response for this API contains the User Comments matching the search criteria in paginated format and the total number of results matching the search criteria.

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. This status will also be returned if a paid FusionAuth license is required and is not present.
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.

Response Body

totalInteger

The total number of User Comments matching the search criteria. Use this value along with the numberOfResults and startRow in the search request to perform pagination.

userCommentsArray

The list of User Comment objects.

userComments[x].commentString

The text of the User Comment.

userComments[x].commenterIdUUID

The Id of the User that wrote the User Comment.

userComments[x].idUUID

The Id of the User Comment.

userComments[x].insertInstantLong

The instant when the comment was written.

userComments[x].userIdUUID

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",
      "id": "00000000-0000-0000-0000-000000000042",
      "insertInstant": 1471786483322,
      "userId": "00000000-0000-0000-0000-000000000003"
    }
  ],
  "total": 1
}