Content

Write a content key to the draft

Stages one key (a page, layout, fragment or data file). A layout's key is layouts/<name>.html and a fragment's is fragments/<name>.html; a <dotsy-fragment name> tag and a route's layout use the bare name. Nothing is live until you publish. The answer is 201 when the key is new and 200 when it replaced an existing one. Writing the same body again changes nothing.

Send { body, contentType? }. With ?format=post, send a blog post document { meta, body, head?, slug? } instead; the server builds the page from it. Keys under .dotsy/, .structure/, _intent/ and _data/ are reserved (400 reserved_key). For a body over about 60 KB, use PUT …/content-raw/{key} or a changeset with staged chunks.

put/api/v1/sites/{slug}/content/{key}

Request

  • Base URL: https://api.dotsy.ai
  • URL: https://api.dotsy.ai/api/v1/sites/{slug}/content/{key}
  • Auth: one of:
    • HTTP bearer
    • HTTP bearer

Path parameters

slugstring required
Example:acme-studio

Site slug or site id (UUID). An old slug answers 301/308 and a site id 307 to the canonical slug path.

keystring required

Percent-encode each segment; '/' may be sent raw or as %2F. Keys may contain '/'.

Query parameters

format'post'

post: the body is a blog post document (PutPostRequest) rather than a file.

Headers

If-Matchstring

The ETag / contentHash you read, quoted or bare. If the key changed since, the write answers 409 conflict and changes nothing.

Request body

OR

Example request

{
  "body": "<h1>About us</h1><p>We make good things.</p>",
  "contentType": "text/html; charset=utf-8"
}

Response

Replaced an existing key.

keystring required

The content key.

contentTypestring required
contentHashstring required

SHA-256 of the effective body: the staged draft if there is one, else the live version. Send it back as If-Match on a write to refuse the write if someone else changed the key meanwhile.

updatedAtnumber required

Write time, Unix ms.

createdboolean required

True when the key did not exist before this write (the status is then 201).

warningsstring[]

Non-blocking notes about the content: tags that will not compose (<key>: <code> — <what to change>; codes fragment_unclosed, fragment_bad_name, fragment_full_document, fragment_self_reference, fragment_attr_hyphen, legacy_paige_tag, layout_missing_content, unknown_dotsy_syntax) or post fields that were not saved. The write still happened.

publishedfalse required

Always false: the change is staged in the draft until you publish.

hintstring required

Reminder that the change is staged and how to make it live.

Example response

{
  "key": "about.html",
  "contentType": "text/html; charset=utf-8",
  "contentHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
}

Changes

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