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

Update a post

PUThttps://api.testingapis.com/api/Posts/{id}

Parameters 1

NameTypeDescription
idrequiredpath · integer (int32)Post ID.

Request body

Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. Model: Post. The new field values.

Example body
{
  "userId": 101,
  "title": "Getting Started with REST APIs",
  "body": "REST APIs are the backbone of modern web applications. In this post, we'll cover the basics of HTTP methods, status codes, and request/resp…",
  "tags": ["api", "tutorial", "beginner"],
  "publishedAt": "2025-07-01T14:00:00Z",
  "likes": 42
}

Responses

200
Updated; returns { message, data }.
404
The post does not exist.
500
Unexpected server error.

Example

Request
curl -X PUT "https://api.testingapis.com/api/Posts/16" \
  -H "Content-Type: application/json" \
  -d '{"userId": 101, "title": "Getting Started with REST APIs", "body": "REST APIs are the backbone of modern web applications. In this post, we'\''ll cover the basics of HTTP methods, status codes, and request/resp…", "tags": ["api", "tutorial", "beginner"], "publishedAt": "2025-07-01T14:00:00Z", "likes": 42}'
Response200 OK
{
  "message": "Post updated successfully",
  "data": {
    "id": 16,
    "userId": 101,
    "title": "Getting Started with REST APIs",
    "body": "REST APIs are the backbone of modern web applications. In this post, we'll cover the basics of HTTP methods, status codes, and request/re…
    "tags": ["api", "tutorial", "beginner"],
    "publishedAt": "2025-07-01T14:00:00Z",
    "likes: 42
  }
}