Entry comments
Users can add comments to an entry. This allows for teams to collaborate and have conversations.
Availability
Comments are globally available for all customers.
Mentions in comments
Mentions in comments allow you to tag collaborators in the comments tab of an entry. By including the ”@” followed by an individual’s or team’s name, you can directly engage in conversations regarding feedback, workflow statuses, or general comments.
Only when creating a comment that includes a mention of a collaborator, the mentioned recipient will receive an email notification. The following comments that do not include a mention of a user or team, such as replies or updates, will not be subject to notifications.
NodeTypes are accepted: document, paragraph, text and now mention.To mention users, you must provide a body in Contenful’s rich-text format. There, include a node of type mention where you indicate the user ID, using the following code:
To mention teams, instead of indicating the ‘user ID’ and a ‘linkType: User’, include the ‘team ID’ and use ‘Team’ as the ‘linkType’. For example:
To submit comments with rich-text, provide the following header: x-contentful-comment-body-format to mention a user in the comment with the value: rich-text. You can request a comment using either format plain-text or rich-text by passing either value in this header.
The request for the header will return the following:
If you request a comment that was previously created as rich-text and request without a header or plain-text header specification, the comment will be returned in plain-text. In the plain-text representations, mentions will have the following format: User(id=1xGZIRXr2WPnsLkKfREo0z). You can also fetch the rich-text representation of a plain-text comment by passing rich-text as the value in the above header.
Comment schema
A comment has two top level properties: body and sys.
These are described in detail below.
In addition to the common sys properties comments have the following extra sys
properties
The property resolvedBy is only defined if the comment is resolved. Reopening a comment will remove the field from the sys property.
Entry comments collection
Use this endpoint to get all the comments of an entry. This API does not offer pagination, calls to it will return all the existing comments.
It is possible to filter comments by optionally providing the status query parameter, if no value is provided comments with any status will be returned.
Permissions
Any user with read access to an entry can read all the comments in the entry. Space admins can read all the comments in any entry.
Use this endpoint to create a new comment. When using this endpoint, an ID will be
automatically generated for the created comment and returned in the response.
If you want to create a reply to a specific comment, you need to set the header X-Contentful-Parent-Id with the comment ID you want to reply to.
To reference a specific field and locale with your comment, you can set the header X-Contentful-Parent-Entity-Reference. Only values specifying a path to a field and locale of the entry are considered valid, therefore the value must match the pattern fields.<field_id>.<locale_code>.
There’s a limit of 100 comments per entry. An attempt to create more than 100 comments will result in an error.
Permissions
Any user with read access to an entry can create comments in the entry. Space admins can create comments on any entry.
Errors
- A
400 - BadRequesterror is returned if there’s an attempt to create more than 100 comments in one entry. - A
422 - ValidationFailederror is returned if thebodyfield has a value bigger than 512 bytes.
Comment
Use this endpoint to fetch a comment with a specified ID.
Permissions
Any user with read access to an entry can read a comment in the entry. Space admins can read any comment in any entry.
Use this method to delete a comment.
Permissions
Comment creators can delete their own comments. Admins can delete any comment on any entry.
Use this method to modify the body of the comment.
Permissions
The creator or an admin can update the comment.
Errors
- An
403 - AccessDeniederror is returned if a user different from the comment creator or an admin changed the comment body. - A
422 - ValidationFailederror is returned if thebodyfield has a value bigger than 512 bytes.