Create Comment
Creates a new comment and creates a new thread if needed.
Resource Information
This service uses the tomcat application on port 8080 by default.
The context for this API is /crafter-social
, please prefix the API URLs with this context.
HTTP Verb
|
POST
|
URL
|
/api/3/comments |
Response Formats
|
JSON |
Parameters
Name
|
Type
|
Required
|
Description
|
---|---|---|---|
context
|
String
|
✓
|
The ID of the Social Context
|
body
|
String
|
✓
|
The body of the new comment
|
thread
|
String
|
✓
|
Id of the thread to attach this comment
|
parent
|
String
|
Id of the parent for the new comment
|
|
anonymous
|
Boolean
|
Should the comment be posted as
anonymous
|
|
subject
|
String
|
Subject of the comment to be created
|
|
attributes
|
String
|
JSON string representing any extra
attributes of the comment to create
|
|
attachment
|
Binary
|
Binary file to include in the comment
|
Example
Request
POST .../api/3/comments
context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9
body=This is the first comment!
thread=Welcome
Response
Status 200 OK
1{
2 "ancestors": [],
3 "targetId": "Welcome",
4 "subject": "",
5 "body": "This is the first comment!",
6 "createdBy": "59667e8abd4787992596ba6b",
7 "lastModifiedBy": "59667e8abd4787992596ba6b",
8 "createdDate": "2017-07-13T09:09Z",
9 "lastModifiedDate": "2017-07-13T09:09Z",
10 "anonymousFlag": false,
11 "attributes": {
12 "baseUrl": "http://localhost:8080/crafter-social"
13 },
14 "attachments": [],
15 "moderationStatus": "UNMODERATED",
16 "votesUp": [],
17 "votesDown": [],
18 "flags": [],
19 "_id": "59678d3f300426156e21df50"
20}
Responses
Status
|
Location
|
Response Body
|
---|---|---|
200
|
See example above.
|
|
400
|
{ "message" : "Maximum upload size of ...
bytes exceeded" }
|
|
401
|
{ "message" : "User must be logged in" } |
|
403
|
{ "message" : "Current subject does not have
permission to execute global action ..." }
|
|
500
|
{ "message" : "Internal server error" } |