CH

CodeHub

API Playground

← All collections

Collection Docs

Blog Posts Collection

Blog posts demonstrating slug uniqueness and text search capabilities.

Fields

text

title

Required; post title.

text

slug

Required + unique; URL-friendly identifier (e.g., "my-awesome-post").

textarea

summary

Required; post summary/excerpt.

textarea

body

Required; full post content.

checkbox

published

Boolean; defaults to false.

REST Endpoints

GET/api/blog-posts

List posts. Use ?where[title][contains]=keyword for text search.

GET/api/blog-posts/:id

Fetch one post by document ID.

POST/api/blog-posts

Create a post. Slug must be unique. Try duplicate slugs to see error.

PATCH/api/blog-posts/:id

Update post fields.

DELETE/api/blog-posts/:id

Delete a blog post document.

Teaching Tips

  • Search by title: ?where[title][contains]=tutorial
  • Filter published: ?where[published][equals]=true
  • Try creating duplicate slugs to see uniqueness validation error.
  • Search in body: ?where[body][contains]=keyword