Write API test run
Every write route in goatboat's content API, exercised on one scratch post that gets deleted at the end. This site only reads, so this is a record of a run, not a live call.
Recorded Oct 12, 2026 at 17:55.
1. Write without a token
401 UnauthorizedWrites need a bearer token. Reads don't.
httprequest.httpPOST /api/content Content-Type: application/json {}2. Invalid slug
400 Bad RequestInput is validated with zod before anything reaches the database.
httprequest.httpPOST /api/content Authorization: Bearer <token> Content-Type: application/json { "slug": "Bad Slug", "type": "post", "title": "x" }3. Create a draft post
201 CreatedUnder the /posts section. path is derived from the parent's path plus the slug.
httprequest.httpPOST /api/content Authorization: Bearer <token> Content-Type: application/json { "parentId": "fa8f9e44-0824-43db-8e1f-b3934b02b17b", "slug": "scratch-write-test", "type": "post", "title": "Scratch" }4. Same path again
409 ConflictThe database's unique (parent_id, slug) index rejects it.
httprequest.httpPOST /api/content Authorization: Bearer <token> Content-Type: application/json { "parentId": "fa8f9e44-0824-43db-8e1f-b3934b02b17b", "slug": "scratch-write-test", "type": "post", "title": "Again" }5. Edit title and body
200 OKChanging the body recomputes the stored table of contents.
httprequest.httpPATCH /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da Authorization: Bearer <token> Content-Type: application/json { "title": "Scratch, edited", "body": "Intro\n\n## First heading\n\ntext" }6. Try to change the slug with PATCH
400 Bad RequestSlug and parent only change through move, so redirects are kept.
httprequest.httpPATCH /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da Authorization: Bearer <token> Content-Type: application/json { "slug": "nope" }7. Link fields on a post
400 Bad RequestOnly link content has a target URL.
httprequest.httpPATCH /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da Authorization: Bearer <token> Content-Type: application/json { "link": { "viaName": "x" } }8. Publish
200 OKSets status and stamps published_at.
httprequest.httpPOST /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da/publish Authorization: Bearer <token>9. Unpublish
200 OKBack to draft. published_at is kept.
httprequest.httpPOST /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da/unpublish Authorization: Bearer <token>10. Publish again
200 OKRepublishing keeps the original date.
httprequest.httpPOST /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da/publish Authorization: Bearer <token>11. Rename
200 OKMoving leaves a redirect at the old path.
httprequest.httpPOST /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da/move Authorization: Bearer <token> Content-Type: application/json { "slug": "scratch-moved" }12. Request the old path
200 OKThe read API answers with where it lives now.
httprequest.httpGET /api/content/by-path?path=/posts/scratch-write-test13. Link post without its link
400 Bad Requesttype link requires a link object.
httprequest.httpPOST /api/content Authorization: Bearer <token> Content-Type: application/json { "slug": "scratch-link", "type": "link", "title": "L" }14. Create a link post
201 CreatedThe content row and its content_links row are written in one transaction.
httprequest.httpPOST /api/content Authorization: Bearer <token> Content-Type: application/json { "slug": "scratch-link", "type": "link", "title": "L", "link": { "targetUrl": "https://example.com", "viaName": "HN" } }15. Delete the link post
204 No ContentIts content_links row goes with it.
httprequest.httpDELETE /api/content/1f4f8160-9b7a-4e78-8974-736d53296341 Authorization: Bearer <token>16. Delete the /posts section
409 ConflictNodes with children can't be deleted.
httprequest.httpDELETE /api/content/fa8f9e44-0824-43db-8e1f-b3934b02b17b Authorization: Bearer <token>17. Delete the scratch post
204 No ContentIts redirects go with it.
httprequest.httpDELETE /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da Authorization: Bearer <token>18. Request the new path
404 Not FoundGone.
httprequest.httpGET /api/content/by-path?path=/posts/scratch-moved19. Request the old path
404 Not FoundThe redirect went with the row.
httprequest.httpGET /api/content/by-path?path=/posts/scratch-write-test
Related
- Content tree
Every node nested under its parent. Paths, and so URLs, come from this tree.
- Tags
Every tag with its count. Each links to the feed filtered by that tag.
- Projects
Every project and experiment, any status, with kind and status shown.
- Page identity: an ID on the first line
Why code pages carry a goatboat ID on their first line, and the alternatives weighed for following pages across folder moves.