Help Search

Create a comment

To create a new comment on a resource, make a POST request with the comment data in request body. And a valid request will look like:

POST /comments/resource/<resourceId>.json?api-version=v2
{
  "content": "Comment posted via passbolt API"
}

Request data

The request body expects the following parameters:

Parameter Description Required Validation Constraints
content Comment text Yes
  1. Valid utf8 string
  2. Must not exceed 255 characters

Possible responses

Code Description
200 OK
The Comment was created. The response body will contain the newly created comment object
400 Bad Request
Some of the data validation failed.
403 Authentication Failure
The user making the request is not authenticated

Examples

Validation error response

A successful request must pass all the validation checks. For example sending a blank request body will return

{
    "header": {
        "id": "c12fc0f8-ea1d-49aa-a756-6632a5a806f5",
        "status": "error",
        "servertime": 1554985568,
        "title": "app_comments_addPost_error",
        "action": "10369fc0-dcec-5bc0-8bb6-bd2809d51d5f",
        "message": "Could not validate user data.",
        "url": "\/comments\/resource\/8e3874ae-4b40-590b-968a-418f704b9d9a.json?api-version=v2",
        "code": 400
    },
    "body": {
        "content": {
            "_empty": "The content should not be empty"
        }
    }
}

Last updated

This article was last updated on April 23rd, 2019.

If you are familiar with the high level API concepts and only looking for the endpoint implementation details, there is a repository with the latest OpenAPI 2.0 specifications (compatible with Swagger).

OpenAPI Specs