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. 1. Write without a token

    401 Unauthorized

    Writes need a bearer token. Reads don't.

    httprequest.http
    POST /api/content
    Content-Type: application/json
    
    {}
  2. 2. Invalid slug

    400 Bad Request

    Input is validated with zod before anything reaches the database.

    httprequest.http
    POST /api/content
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "slug": "Bad Slug",
      "type": "post",
      "title": "x"
    }
  3. 3. Create a draft post

    201 Created

    Under the /posts section. path is derived from the parent's path plus the slug.

    httprequest.http
    POST /api/content
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "parentId": "fa8f9e44-0824-43db-8e1f-b3934b02b17b",
      "slug": "scratch-write-test",
      "type": "post",
      "title": "Scratch"
    }
  4. 4. Same path again

    409 Conflict

    The database's unique (parent_id, slug) index rejects it.

    httprequest.http
    POST /api/content
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "parentId": "fa8f9e44-0824-43db-8e1f-b3934b02b17b",
      "slug": "scratch-write-test",
      "type": "post",
      "title": "Again"
    }
  5. 5. Edit title and body

    200 OK

    Changing the body recomputes the stored table of contents.

    httprequest.http
    PATCH /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. 6. Try to change the slug with PATCH

    400 Bad Request

    Slug and parent only change through move, so redirects are kept.

    httprequest.http
    PATCH /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "slug": "nope"
    }
  7. 7. Link fields on a post

    400 Bad Request

    Only link content has a target URL.

    httprequest.http
    PATCH /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "link": {
        "viaName": "x"
      }
    }
  8. 8. Publish

    200 OK

    Sets status and stamps published_at.

    httprequest.http
    POST /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da/publish
    Authorization: Bearer <token>
  9. 9. Unpublish

    200 OK

    Back to draft. published_at is kept.

    httprequest.http
    POST /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da/unpublish
    Authorization: Bearer <token>
  10. 10. Publish again

    200 OK

    Republishing keeps the original date.

    httprequest.http
    POST /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da/publish
    Authorization: Bearer <token>
  11. 11. Rename

    200 OK

    Moving leaves a redirect at the old path.

    httprequest.http
    POST /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da/move
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "slug": "scratch-moved"
    }
  12. 12. Request the old path

    200 OK

    The read API answers with where it lives now.

    httprequest.http
    GET /api/content/by-path?path=/posts/scratch-write-test
  13. 13. Link post without its link

    400 Bad Request

    type link requires a link object.

    httprequest.http
    POST /api/content
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "slug": "scratch-link",
      "type": "link",
      "title": "L"
    }
  14. 14. Create a link post

    201 Created

    The content row and its content_links row are written in one transaction.

    httprequest.http
    POST /api/content
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "slug": "scratch-link",
      "type": "link",
      "title": "L",
      "link": {
        "targetUrl": "https://example.com",
        "viaName": "HN"
      }
    }
  15. 15. Delete the link post

    204 No Content

    Its content_links row goes with it.

    httprequest.http
    DELETE /api/content/1f4f8160-9b7a-4e78-8974-736d53296341
    Authorization: Bearer <token>
  16. 16. Delete the /posts section

    409 Conflict

    Nodes with children can't be deleted.

    httprequest.http
    DELETE /api/content/fa8f9e44-0824-43db-8e1f-b3934b02b17b
    Authorization: Bearer <token>
  17. 17. Delete the scratch post

    204 No Content

    Its redirects go with it.

    httprequest.http
    DELETE /api/content/b36a3620-7ab9-49de-9c45-609cd06ef1da
    Authorization: Bearer <token>
  18. 18. Request the new path

    404 Not Found

    Gone.

    httprequest.http
    GET /api/content/by-path?path=/posts/scratch-moved
  19. 19. Request the old path

    404 Not Found

    The redirect went with the row.

    httprequest.http
    GET /api/content/by-path?path=/posts/scratch-write-test
  • 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.