Posts

Create a post

post/posts

Request

  • Base URL
    https://gorest.co.in/public/v3
  • URL
    https://gorest.co.in/public/v3/posts
  • Auth
    HTTP bearer

Headers

Idempotency-Keystring

A unique key (a UUID is fine) that makes a POST safe to retry for 24 hours. A retry with the same key, path and body gets the first answer again with Idempotent-Replayed: true and creates nothing; a retry while the first is still running gets 409 conflict with Retry-After: 1. The same key with another request gets 422 idempotency_key_mismatch. Only a 2xx answer is kept, so after an error the retry runs again. An answer over 64 KiB, or one that holds a new token's value, is not kept: its retry gets 409 conflict with the Location of what the first request made.

Request body

bodystring required
status'draft' | 'published'
titlestring required

Not blank; spaces at the ends are dropped.

user_idstring uuid required

Response

The new post.

bodystring
created_atstring date-time
idstring uuid required
published_atstring date-time nullable

Set by the server when the post is first published; null for a draft.

read_onlyboolean

True for sample data (the seed); it cannot be changed.

status'draft' | 'published'
titlestring
updated_atstring date-time
user_idstring uuid

The author; a user you can see.

Example response

{
  "comments": [
    {
      "post": {
        "title": "Cursor paging in five minutes",
        "user": {
          "email": "aarav.sharma@example.com",
          "name": "Aarav Sharma"
        }
      },
      "user": {
        "email": "aarav.sharma@example.com",
        "name": "Aarav Sharma"
      }
    }
  ],
  "title": "Cursor paging in five minutes",
  "user": {
    "email": "aarav.sharma@example.com",
    "name": "Aarav Sharma"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.