Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions 14_Comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,25 @@ DELETE /api/v2/comments/:id
- `parent_comment`: {Comment} The comment this comment is attach to. Either this or `story` will be present.
- `story`: {Story} The story this comment is attached to.
- `user`: {User} The user that left this comment

### Posting a comment

Here's how we would post a comment for a story with ID `101` as a user with ID `1`

```
curl -X POST \
-H "Authorization: Bearer <your_auth_token>" \
-H "Content-Type: application/vnd.api+json" \
-d '{"comments":{"comment":{"body": "First story message"},"links":{"story":"101","user":"1"}}}'\
https://www.designernews.co/api/v2/comments/
```

Here's how we would post a reply for a comment with ID `123` as a user with ID `1`

```
curl -X POST \
-H "Authorization: Bearer <your_auth_token>" \
-H "Content-Type: application/vnd.api+json" \
-d '{"comments":{"comment":{"body": "First message"},"links":{"parent_comment":"123","user":"1"}}}' \
https://www.designernews.co/api/v2/comments/
```