User Comment APIs
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
POST /api/user/comment
Request Headers
- X-FusionAuth-TenantId [String] Optional
-
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.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.
{
"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.
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.comment [String]
-
The text of the User Comment.
- userComment.commenterId [UUID]
-
The Id of the User that wrote the User Comment.
- userComment.createInstant [Long] Deprecated
-
The instant when the comment was written. This was deprecated in 1.18.0. Use
insertInstant
instead. - userComment.insertInstant [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.
{
"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
Retrieve all Comments for a User by Id
GET /api/user/comment/{userId}
Request Headers
- X-FusionAuth-TenantId [String] Optional
-
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
- userId [UUID] Required
-
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.
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
- 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] Deprecated -
The instant when the comment was written. This was deprecated in 1.18.0. Use
insertInstant
instead. - userComments
[x]
.id [UUID] -
The Id of the User Comment.
- userComments
[x]
.insertInstant [Long] -
The instant when the comment was written.
- userComments
[x]
.userId [UUID] -
The Id of the User that the User Comment was written for.
{
"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
GET /api/user/comment/search?comment={comment}
Request Headers
- X-FusionAuth-TenantId [String] Optional
-
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
- comment [String] Optional
-
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*
. - commenterId [UUID] Optional
-
Restricts the results to User Comments created by the given User.
- numberOfResults [Integer] Optional defaults to
25
-
The number of results to return from the search.
- orderBy [String] Optional defaults 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
orDESC
. If omitted, the default sort order isASC
.For example, to order the results by the insert instant in a descending order, use
insertInstant DESC
. -
- startRow [Integer] Optional defaults 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 results26-50
, assuming the default page size. - tenantId [UUID] Optional
-
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. - userId [UUID] Optional
-
Restricts the results to User Comments belonging to the given User.
POST /api/user/comment/search
Request Headers
- X-FusionAuth-TenantId [String] Optional
-
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.comment [String] Optional
-
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.commenterId [UUID] Optional
-
Restricts the results to User Comments created by the given User.
- search.numberOfResults [Integer] Optional defaults to
25
-
The number of results to return from the search.
- search.orderBy [String] Optional defaults 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
orDESC
. If omitted, the default sort order isASC
.For example, to order the results by the insert instant in a descending order, use
insertInstant DESC
. -
- search.startRow [Integer] Optional defaults 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 results26-50
, assuming the default page size. - search.tenantId [UUID] Optional
-
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.userId [UUID] Optional
-
Restricts the results to User Comments belonging to the given User.
{
"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.
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
- total [Integer]
-
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.
- 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]
.id [UUID] -
The Id of the User Comment.
- userComments
[x]
.insertInstant [Long] -
The instant when the comment was written.
- userComments
[x]
.userId [UUID] -
The Id of the User that the User Comment was written for.
{
"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
}
Feedback
How helpful was this page?
See a problem?
File an issue in our docs repo
Have a question or comment to share?
Visit the FusionAuth community forum.