TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Create a comment

POSThttps://api.testingapis.com/api/CommentsSign in to see this endpoint's URL

Request body

Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. Model: Comment. The new comment. Any client-supplied ID is replaced.

Example body
{"postId": 1, "userId": 102, "body": "Great post!"}

Responses

200
OK
201
Created; returns { message, data } with the generated ID.
400
body is missing.
500
Unexpected server error.

Example

Request
curl -X POST "https://api.testingapis.com/api/Comments" \
  -H "Content-Type: application/json" \
  -d '{"postId": 1, "userId": 102, "body": "Great post!"}' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response201 Created
{
  "message": "Comment created successfully",
  "data": {
    "id": 54,
    "postId": 1,
    "userId": 102,
    "body": "Great post!",
    "createdAt": "2026-09-30T18:26:45Z"
  }
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.