How to create a comment using comments API

How to create a comment using comments API?

please try this

curl -i -H "Accept:application/json" -H "Content-Type:application/json" -H "Authorization: Bearer YOUR-ACCESS-TOKEN" -XPOST "https://gorest.co.in/public/v2/comments" -d '{"post_id":123, "name":"Sanya Varma", "email":"[email protected]", "body":"this is how we can create a comment"}'

Similar code should work with any other language also, just make sure the post_id used is available in GET /public/v2/posts

{"postid":123, "name":"Sanya Varma", "email":"sanya[email protected]", "body":"this is how we can create a comment"}

If we this request body it is showing following error message.

{"field": "post", "message": "must exist"}

Irrespective of what we use, whether it is post_id or post, it is not working


Little markdown supported