Update a page

Update a single page. Absent fields keep their stored values, so a request that sends only title changes only the title.

PATCH https://sitepaste.com/api/v1/public/sites/{siteId}/pages/{contentType}/{section}/{slug}

Requires the content scope.

Use the batch when you are writing several pages at once or renaming a slug.

This route never creates a page. A path that names no page is a 404. To create one, use POST /sites/{siteId}/pages.

Usage

curl -X PATCH "https://sitepaste.com/api/v1/public/sites/default/pages/blog/hello-world" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Hello, world", "draft": false }'

Addressing a page

A page’s address is its content type, then its section if it has one, then its slug. The address takes no query parameters.

PageURI
A blog post hello/sites/{siteId}/pages/blog/hello
A docs page install in section setup/sites/{siteId}/pages/docs/setup/install
A standalone page about/sites/{siteId}/pages/standalone/about
A standalone page in a nested section/sites/{siteId}/pages/standalone/api/media/get-media
The site’s homepage/sites/{siteId}/pages/homepage

The section is matched exactly: pages/docs/install names the docs page with no section, and the one inside setup is a 404 until you name the section too. The homepage has no section and no slug in its address, because a site has only one.

Body

Every field POST /sites/{siteId}/pages accepts, except the ones that identify the page.

contentType, section, and slug may only repeat what the path says, and one that names something else is a 422. To move or rename a page, send its id to the batch. Echoing back the values and the id from a read is accepted, so you can GET the page, change a field, and PATCH the whole object back. An id naming a different page is refused.

A section in the body does not have to match the path’s casing. Omitting it leaves the page where it is.

pages and deleteSlugs belong to POST /sites/{siteId}/pages/batch. The site is the one named in the path. Publish your change with POST /sites/{siteId}/deployments.

Response

200 OK with the full page record, in the same representation GET /sites/{siteId}/pages/{pagePath} answers, content, tags, theme overrides, and params included, as stored after the write.

422 with fields when the body does not validate or names a different page, 404 when no page on the site matches the slug, content type, and section.