Cosmovex Tools

Need a fake blog API? Get posts, comments and authors that link together

Blog posts API with Mock API Studio

The editor below is preset with three linked resources: users (the authors), posts with a userId, slug, status and tags, and comments with a postId. Press Create my API and every post points at a real author and every comment at a real post, so a blog index, a post page with its comments and a drafts screen all work against one API. Free keeps 2 resources, so on Free you create /users and /posts (or untick /users to keep posts and comments); all three together need Pro.

  1. Check the three resources in the editor. On Free, untick the one you do not need: Free keeps 2 resources per project, Pro gives 50. userId and postId are detected as links (shown with an arrow in the preview), so generated posts and comments point at ids that exist.
  2. Keep 25 records per resource (the free maximum) and press Create my API. With all three ticked on Free, the Pro wall offers to create the first two instead.
  3. Build the index: GET /posts?status=published&sort=publishedAt&order=desc&_page=1&_limit=10. The Link header gives the next and previous page URLs.
  4. Build the post page: GET /posts/1 for the article, GET /users/1 for the author box and GET /comments?postId=1 for its comments.
  5. Build the editor: POST /comments adds a comment to a post, PATCH /posts/2 with {"status":"published"} publishes a draft, and DELETE /comments/1 moderates one away.
fake blog post api fake blog apifake api posts and commentsmock blog api jsondummy posts apifake comments api
Open Mock API Studio Free · Pro $5/mo · no account

What to know

A blog frontend is mostly relationships: an author on every card, a comment count on every post, a post page that pulls in its comments. A mock that only returns flat lists makes you fake those joins in the client. Here the links are real data: the generator fills userId and postId with ids that exist in the other resource, so GET /comments?postId=7 returns the comments that belong to post 7 and nothing else.

Field names shape the content. title gets a short headline, body and excerpt get paragraphs of placeholder text, slug gets a hyphenated slug, cover gets a working image URL, tags gets an array of words, and publishedAt gets dates over the past year, so sorting by date and grouping by month have data to work with. Your sample posts keep their exact text at the top of the list.

Drafts and publishing are just a status field, which is validated against the values in your samples (published and draft here). PATCH a post to {"status":"archived"} and you get a 422 naming the field; add an archived sample before creating the API if you want that state. ?status_ne=draft lists everything that is not a draft, and ?title_like=react finds posts by title only.

On the free plan you join resources with filters: /comments?postId=1 and /posts?userId=1. Pro adds nested routes such as /posts/1/comments and ?_expand=user, which embeds the author object in each post, so a card can render without a second request. Both read the same stored data, so moving from one style to the other needs no change to the records.

Updated · Cosmovex

Questions

How do I get all comments for one post?

GET /comments?postId=1. The response is a JSON array and the X-Total-Count header holds how many there are, which is all a comment count badge needs (add &_limit=1 if you only want the count).

Can I embed the author inside each post?

With Pro, GET /posts?_expand=user adds the author as a user object next to userId, and /users/1/posts lists one author's posts. On the free plan, fetch /users/:id separately or load /users once and join in the client.

Do new comments really get saved?

Yes. POST /comments with {"postId":1,"name":"Jo","email":"jo@example.com","body":"Nice"} returns 201 with the new id and a Location header, and it appears in /comments?postId=1 from then on.

Is the post content realistic text?

Titles, bodies and excerpts are generated placeholder text in Latin-style words, so lengths vary like real posts but the words are not meaningful. Your own sample posts keep their exact content, and you can edit any cell in the data grid on this page.

Can I add categories or tags as their own endpoint?

On Pro, yes: a Pro project holds up to 50 resources. A free project holds 2, so on Free categories would replace /users or /comments. Add a "categories" array and a categoryId field on posts before you create the API, and posts will point at real category ids.

The free plan covers everything on this page. Mock API Studio Pro ($5/mo, billed monthly) is described on the Mock API Studio page.