{
  "@type": "HeadlessPages",
  "@id": "/_api/headless_pages/2001",
  "uid": 2001,
  "title": "Quick start",
  "slug": "/quick-start",
  "seo_title": "",
  "description": "From composer require to the first typed request, with the output of every step.",
  "no_index": 0,
  "no_follow": 0,
  "canonical_link": null,
  "og_title": "",
  "og_description": null,
  "og_image": [],
  "breadcrumbs": [
    {
      "uid": 2000,
      "title": "tca-api-headless",
      "nav_title": "",
      "url": "https://typo3.example/website/",
      "doktype": 1
    },
    {
      "uid": 2001,
      "title": "Quick start",
      "nav_title": "",
      "url": "https://typo3.example/website/quick-start",
      "doktype": 1
    }
  ],
  "languages": [
    {
      "languageId": 0,
      "locale": "en-US",
      "hreflang": "en",
      "title": "English",
      "url": "https://typo3.example/website/quick-start",
      "available": true,
      "active": true
    },
    {
      "languageId": 1,
      "locale": "de-DE",
      "hreflang": "de",
      "title": "German",
      "url": "https://typo3.example/website/de/schnellstart",
      "available": true,
      "active": false
    }
  ],
  "meta": {
    "robots": "index,follow",
    "canonical": "https://typo3.example/website/quick-start",
    "schema": {
      "@context": "https://schema.org",
      "@type": "WebPage",
      "url": "https://typo3.example/website/quick-start",
      "name": "Quick start",
      "inLanguage": "en",
      "description": "From composer require to the first typed request, with the output of every step."
    },
    "alternates": [
      {
        "hreflang": "en",
        "href": "https://typo3.example/website/quick-start"
      },
      {
        "hreflang": "de",
        "href": "https://typo3.example/website/de/schnellstart"
      },
      {
        "hreflang": "x-default",
        "href": "https://typo3.example/website/quick-start"
      }
    ]
  },
  "regions": {
    "main": [
      {
        "uid": 2010,
        "CType": "text",
        "header": "Five steps to typed JSON",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [],
                "text": "From an existing TYPO3 site to a typed response. Every request on this page ran against this site's TYPO3 instance while the page was built; the recorded response sits under it."
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      },
      {
        "uid": 2016,
        "CType": "text",
        "header": "Require the package",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [
                  "code"
                ],
                "text": "composer require maikschneider/tca-api-headless:dev-main \\\n  \"maikschneider/tca-api:dev-main as 2.4.0\""
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k3",
            "style": "normal",
            "markDefs": [
              {
                "_key": "k2",
                "_type": "link",
                "href": "https://github.com/maikschneider/tca-api",
                "target": "_blank",
                "title": "TCA API on GitHub"
              }
            ],
            "children": [
              {
                "_type": "span",
                "_key": "k4",
                "marks": [],
                "text": "It brings "
              },
              {
                "_type": "span",
                "_key": "k5",
                "marks": [
                  "k2"
                ],
                "text": "TCA API"
              },
              {
                "_type": "span",
                "_key": "k6",
                "marks": [],
                "text": " 2.4 or later and runs on TYPO3 13.4 and 14.3. Both are in development: until their stable releases, use the explicit constraints above. Install EXT:seo ("
              },
              {
                "_type": "span",
                "_key": "k7",
                "marks": [
                  "code"
                ],
                "text": "typo3/cms-seo"
              },
              {
                "_type": "span",
                "_key": "k8",
                "marks": [],
                "text": ") for the SEO fields of pages."
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      },
      {
        "uid": 2017,
        "CType": "text",
        "header": "Add the site set",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [],
                "text": "Add the set to every site that should deliver headless pages; it includes TCA API's set. Sites without it serve none of the extension's resources. This is the "
              },
              {
                "_type": "span",
                "_key": "k2",
                "marks": [
                  "code"
                ],
                "text": "config.yaml"
              },
              {
                "_type": "span",
                "_key": "k3",
                "marks": [],
                "text": " of the site you are reading:"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k4",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k5",
                "marks": [
                  "code"
                ],
                "text": "dependencies:\n  - maikschneider/tca-api-headless"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k6",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k7",
                "marks": [],
                "text": "A few site settings change the defaults. This site's "
              },
              {
                "_type": "span",
                "_key": "k8",
                "marks": [
                  "code"
                ],
                "text": "settings.yaml"
              },
              {
                "_type": "span",
                "_key": "k9",
                "marks": [],
                "text": ":"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k10",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k11",
                "marks": [
                  "code"
                ],
                "text": "tca_api_headless:\n  navigation:\n    depth: 2\n    maxDepth: 4\n  fallbackCTypes: []"
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      },
      {
        "uid": 2018,
        "CType": "text",
        "header": "Look up a path",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [],
                "text": "A frontend knows the URL. The lookup turns its path into the page's "
              },
              {
                "_type": "span",
                "_key": "k2",
                "marks": [
                  "code"
                ],
                "text": "uid"
              },
              {
                "_type": "span",
                "_key": "k3",
                "marks": [],
                "text": ":"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k4",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k5",
                "marks": [
                  "code"
                ],
                "text": "curl -H 'Accept: application/ld+json' 'https://example.org/_api/headless_pages?path=/quick-start'"
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      },
      {
        "uid": 2019,
        "CType": "text",
        "header": "Request the page",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [],
                "text": "The page brings its SEO fields, a "
              },
              {
                "_type": "span",
                "_key": "k2",
                "marks": [
                  "code"
                ],
                "text": "meta"
              },
              {
                "_type": "span",
                "_key": "k3",
                "marks": [],
                "text": " object for the head and its content elements, grouped by region:"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k4",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k5",
                "marks": [
                  "code"
                ],
                "text": "curl -H 'Accept: application/ld+json' 'https://example.org/_api/headless_pages/2001'"
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      },
      {
        "uid": 2220,
        "CType": "text",
        "header": "Generate the types",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [],
                "text": "The site's OpenAPI document describes every response. Generate TypeScript from it and compare it in CI:"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k2",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k3",
                "marks": [
                  "code"
                ],
                "text": "curl -o openapi.json 'https://example.org/_api/openapi.json'\nbunx openapi-typescript openapi.json -o src/api/schema.d.ts"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k4",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k5",
                "marks": [],
                "text": "Content elements then narrow on "
              },
              {
                "_type": "span",
                "_key": "k6",
                "marks": [
                  "code"
                ],
                "text": "CType"
              },
              {
                "_type": "span",
                "_key": "k7",
                "marks": [],
                "text": ":"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k8",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k9",
                "marks": [
                  "code"
                ],
                "text": "import type { components } from './api/schema';\n\ntype Page = components['schemas']['HeadlessPagesRead'];\nconst base = 'https://example.org';\nconst headers = { Accept: 'application/ld+json' };\n\nconst lookup = await (await fetch(`${base}/_api/headless_pages?path=/quick-start`, { headers })).json();\nconst page: Page = await (await fetch(`${base}/_api/headless_pages/${lookup['hydra:member'][0].uid}`, { headers })).json();\n\nfor (const content of page.regions.aside ?? []) {\n  if (content.CType === 'table') console.log(content.bodytext?.body); // string[][]\n}"
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      }
    ],
    "aside": [
      {
        "uid": 2011,
        "CType": "bullets",
        "header": "In short",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bullets_type": 1,
        "bodytext": [
          "Require maikschneider/tca-api-headless",
          "Add the site set to the site",
          "Look up the path of a page",
          "Request the page by uid",
          "Generate types from openapi.json"
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      },
      {
        "uid": 2012,
        "CType": "table",
        "header": "Requirements",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": {
          "head": [],
          "body": [
            [
              "TYPO3",
              "13.4 or 14.3"
            ],
            [
              "PHP",
              "8.2 or later"
            ],
            [
              "TCA API",
              "2.4 or later"
            ],
            [
              "EXT:seo",
              "for the SEO fields"
            ]
          ],
          "foot": []
        },
        "table_caption": "From the installation guide",
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": "",
        "table_header_position": 2
      },
      {
        "uid": 2013,
        "CType": "uploads",
        "header": "Downloads",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "media": [
          {
            "uid": 2026,
            "name": "cheat-sheet.txt",
            "extension": "txt",
            "publicUrl": "/fileadmin/website/cheat-sheet.txt",
            "mimeType": "text/plain",
            "fileSize": 632,
            "metadata": {
              "title": null,
              "description": "Every request of the extension on one page"
            }
          },
          {
            "uid": 2001,
            "name": "quick-start.txt",
            "extension": "txt",
            "publicUrl": "/fileadmin/website/quick-start.txt",
            "mimeType": "text/plain",
            "fileSize": 606,
            "metadata": {
              "title": null,
              "description": "The quick start as plain text"
            }
          },
          {
            "uid": 2013,
            "name": "quick start.txt",
            "extension": "txt",
            "publicUrl": "/fileadmin/website/quick%20start.txt",
            "mimeType": "text/plain",
            "fileSize": 606,
            "metadata": {
              "title": null,
              "description": "The same file, with a space in its name"
            }
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      }
    ]
  }
}