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
URI
Request Headers
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
The text of the User Comment.
The Id of the User that wrote the User Comment.
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 CodesCode | 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
The text of the User Comment.
The Id of the User that wrote the User Comment.
The instant when the comment was written. This was deprecated in 1.18.0. Use insertInstant
instead.
The instant when the comment was written.
The Id of the User Comment.
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
URI
{userId}
Request Headers
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
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
The list of User Comment objects.
The text of the User Comment.
The Id of the User that wrote the User Comment.
The instant when the comment was written. This was deprecated in 1.18.0. Use insertInstant
instead.
The Id of the User Comment.
The instant when the comment was written.
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
URI
?comment={comment}
Request Headers
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
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*
.
Restricts the results to User Comments created by the given User.
The number of results to return from the search.
The field to order the search results as well as an order direction.
The possible values are:
comment
- the User Comment textcommenterId
- the unique Id of the User who created the User Commentid
- the unique Id of the User CommentinsertInstant
- the instant when the User Comment was createdtenantId
-the unique Id of the Tenant to which the User Comment belongsuserId
- 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
.
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.
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.
Restricts the results to User Comments belonging to the given User.
URI
Request Headers
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
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*
.
Restricts the results to User Comments created by the given User.
The number of results to return from the search.
The field to order the search results as well as an order direction.
The possible values are:
comment
- the User Comment textcommenterId
- the unique Id of the User who created the User Commentid
- the unique Id of the User CommentinsertInstant
- the instant when the User Comment was createdtenantId
-the unique Id of the Tenant to which the User Comment belongsuserId
- 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
.
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.
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.
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.
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
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.
The list of User Comment objects.
The text of the User Comment.
The Id of the User that wrote the User Comment.
The Id of the User Comment.
The instant when the comment was written.
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
}