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-TenantIdStringoptional

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#

commentStringoptional

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*.

commenterIdUUIDoptional

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

numberOfResultsIntegeroptionalDefaults to 25

The number of results to return from the search.

orderByStringoptionalDefaults 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.

startRowIntegeroptionalDefaults 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.

tenantIdUUIDoptional

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.

userIdUUIDoptional

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

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

Request Headers#

X-FusionAuth-TenantIdStringoptional

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.commentStringoptional

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.commenterIdUUIDoptional

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

search.numberOfResultsIntegeroptionalDefaults to 25

The number of results to return from the search.

search.orderByStringoptionalDefaults 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.startRowIntegeroptionalDefaults 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.tenantIdUUIDoptional

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.userIdUUIDoptional

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
CodeDescription
200The request was successful. The response will contain a JSON body.
400The 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.
401You 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.
500There 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
}