Skip to navigation

Write a page’s element tree from the REST API

The Create Page and Update Page endpoints now accept an optional elements field, so you can set a page’s element tree when you create or update the page.

POST /v6/pages
PATCH /v6/pages/{pageIdOrPathname}
  • Create: if you leave out elements, the page starts with an empty root.
  • Update: if you send elements, it replaces the page’s entire tree.
  • Tree shape: the root node has type set to ./components/Root/index.js, a key (a UUID that’s unique within the tree), and props. This is the same shape that include=elements returns on Get Page.
  • Responses: Create Page and Update Page return elements: null. To read the tree after a write, call Get Page with include=elements.

Error response changes

  • A pathname that’s invalid or already in use now returns 400 instead of 409. A 400 is also returned for an invalid element tree.
  • Create Page returns 404 if the site doesn’t exist. Update Page returns 404 if the page or its site doesn’t exist.

The elements field is in beta and may change. Requests that send it return 403 until the feature is enabled for your site or workspace. To opt in, contact support: support@makeswift.com.

For details, see Create Page and Update Page.