Docsy / docs

API REFERENCE

Posts · OpenAPI sample

Public JSONPlaceholder requests, generated from a local OpenAPI file. Copy GET, POST, PUT, PATCH, and DELETE examples. Writes are simulated and are not persisted.

v1.0.0

Posts

List posts

Read posts, optionally filtering by user. The sample query uses userId=1; no authentication is required.

GET/posts

Query parameters

userIdintegerquery

Return posts belonging to this user. Omit the parameter to list all posts.

GET /posts
curl --request GET \
  --url 'https://jsonplaceholder.typicode.com/posts?userId=1'
Response · 200
[
  {
    "id": 1,
    "userId": 1,
    "title": "An example post",
    "body": "Example response content. Live post text can differ."
  }
]

Posts

Create a post

Send a JSON request body. JSONPlaceholder returns a simulated creation response; a later GET will not retrieve this new post.

POST/posts

Body

application/json
titlestringrequired

The post title.

bodystringrequired

Plain-text content of the post.

userIdintegerrequired

User associated with the post.

POST /posts
curl --request POST \
  --url 'https://jsonplaceholder.typicode.com/posts' \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "Hello from Docsy",
  "body": "This request example comes from OpenAPI, not hardcoded UI.",
  "userId": 1
}'
Response · 201
{
  "id": 101,
  "title": "Hello from Docsy",
  "body": "This request example comes from OpenAPI, not hardcoded UI.",
  "userId": 1
}

Posts

Get a post

Fetch one post by its ID. The generated curl command substitutes the path parameter example from this specification.

GET/posts/{id}

Path parameters

idintegerpathrequired

Existing post identifier. The request example uses post 1.

GET /posts/{id}
curl --request GET \
  --url 'https://jsonplaceholder.typicode.com/posts/1'
Response · 200
{
  "id": 1,
  "userId": 1,
  "title": "An example post",
  "body": "Example response content. Live post text can differ."
}

Posts

Replace a post

Send all writable fields in a JSON body. The replacement is simulated and is not persisted.

PUT/posts/{id}

Path parameters

idintegerpathrequired

Existing post identifier. The request example uses post 1.

Body

application/json
titlestringrequired

The post title.

bodystringrequired

Plain-text content of the post.

userIdintegerrequired

User associated with the post.

PUT /posts/{id}
curl --request PUT \
  --url 'https://jsonplaceholder.typicode.com/posts/1' \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "A replacement post",
  "body": "Replace the complete writable post content.",
  "userId": 1
}'
Response · 200
{
  "id": 1,
  "title": "A replacement post",
  "body": "Replace the complete writable post content.",
  "userId": 1
}

Posts

Update a post title

Send only the fields to change. This request demonstrates a partial JSON body; changes are not persisted.

PATCH/posts/{id}

Path parameters

idintegerpathrequired

Existing post identifier. The request example uses post 1.

Body

application/json
titlestringrequired

Replacement title; other post fields remain unchanged.

PATCH /posts/{id}
curl --request PATCH \
  --url 'https://jsonplaceholder.typicode.com/posts/1' \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "An updated title from Docsy"
}'
Response · 200
{
  "id": 1,
  "userId": 1,
  "title": "An updated title from Docsy",
  "body": "Original post body, unchanged by this PATCH."
}

Posts

Delete a post

Simulate deletion of a post. JSONPlaceholder leaves the original post available; this request does not delete persistent data.

DELETE/posts/{id}

Path parameters

idintegerpathrequired

Existing post identifier. The request example uses post 1.

DELETE /posts/{id}
curl --request DELETE \
  --url 'https://jsonplaceholder.typicode.com/posts/1'
Response · 200
{}
—