tca-api-headless

Links

Typolinks arrive resolved: an absolute href, plus target and title where the editor set them. Page links already point to the request language, file links to the file. Each heading below is a header element with a different link.

Proofregions.intro[0]

Request GET /website/_api/headless_pages/2013 #/regions/intro/0 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "uid": 2200,
  "CType": "textmedia",
  "header": "Links",
  "header_layout": 0,
  "header_position": "",
  "header_link": null,
  "subheader": "",
  "bodytext": [
    {
      "_type": "block",
      "_key": "k0",
      "style": "normal",
      "markDefs": [],
      "children": [
        {
          "_type": "span",
          "_key": "k1",
          "marks": [],
          "text": "Typolinks arrive resolved: an absolute "
        },
        {
          "_type": "span",
          "_key": "k2",
          "marks": [
            "code"
          ],
          "text": "href"
        },
        {
          "_type": "span",
          "_key": "k3",
          "marks": [],
          "text": ", plus "
        },
        {
          "_type": "span",
          "_key": "k4",
          "marks": [
            "code"
          ],
          "text": "target"
        },
        {
          "_type": "span",
          "_key": "k5",
          "marks": [],
          "text": " and "
        },
        {
          "_type": "span",
          "_key": "k6",
          "marks": [
            "code"
          ],
          "text": "title"
        },
        {
          "_type": "span",
          "_key": "k7",
          "marks": [],
          "text": " where the editor set them. Page links already point to the request language, file links to the file. Each heading below is a header element with a different link."
        }
      ]
    }
  ],
  "assets": [
    {
      "uid": 2025,
      "name": "links.jpg",
      "extension": "jpg",
      "publicUrl": "/fileadmin/website/plates/links.jpg",
      "mimeType": "image/jpeg",
      "fileSize": 169605,
      "metadata": {
        "title": null,
        "description": null
      }
    }
  ],
  "layout": 0,
  "frame_class": "default",
  "space_before_class": "",
  "space_after_class": ""
}

Generated TypeScript type

type HeadlessContentTextmediaRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    CType: "textmedia";
    header?: string;
    header_layout?: number;
    header_position?: string;
    header_link?: components["schemas"]["HeadlessLink"] | null;
    subheader?: string;
    bodytext?: components["schemas"]["PortableText"];
    assets?: components["schemas"]["FileObject"][];
    layout?: number;
    frame_class?: string;
    space_before_class?: string;
    space_after_class?: string;
};
Page, file, mail and external typolinks all arrive as one HeadlessLink with an absolute href.

A new tab with a title (opens in a new tab)

Proofregions.main[0]

Request GET /website/_api/headless_pages/2013 #/regions/main/0 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "uid": 2201,
  "CType": "header",
  "header": "A new tab with a title",
  "header_layout": 0,
  "header_position": "",
  "header_link": {
    "href": "https://github.com/maikschneider/tca-api-headless",
    "target": "_blank",
    "title": "tca-api-headless on GitHub"
  },
  "subheader": "",
  "layout": 0,
  "frame_class": "default",
  "space_before_class": "",
  "space_after_class": ""
}

Generated TypeScript type

type HeadlessContentHeaderRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    CType: "header";
    header?: string;
    header_layout?: number;
    header_position?: string;
    header_link?: components["schemas"]["HeadlessLink"] | null;
    subheader?: string;
    layout?: number;
    frame_class?: string;
    space_before_class?: string;
    space_after_class?: string;
};

A page, in the language of the request

Proofregions.main[1]

Request GET /website/_api/headless_pages/2013 #/regions/main/1 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "uid": 2202,
  "CType": "header",
  "header": "A page, in the language of the request",
  "header_layout": 0,
  "header_position": "",
  "header_link": {
    "href": "https://typo3.example/website/quick-start",
    "target": null,
    "title": null
  },
  "subheader": "",
  "layout": 0,
  "frame_class": "default",
  "space_before_class": "",
  "space_after_class": ""
}

Generated TypeScript type

type HeadlessContentHeaderRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    CType: "header";
    header?: string;
    header_layout?: number;
    header_position?: string;
    header_link?: components["schemas"]["HeadlessLink"] | null;
    subheader?: string;
    layout?: number;
    frame_class?: string;
    space_before_class?: string;
    space_after_class?: string;
};

A page of another site

Proofregions.main[2]

Request GET /website/_api/headless_pages/2013 #/regions/main/2 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "uid": 2203,
  "CType": "header",
  "header": "A page of another site",
  "header_layout": 0,
  "header_position": "",
  "header_link": {
    "href": "https://typo3.example/kettenblatt/visit",
    "target": null,
    "title": null
  },
  "subheader": "",
  "layout": 0,
  "frame_class": "default",
  "space_before_class": "",
  "space_after_class": ""
}

Generated TypeScript type

type HeadlessContentHeaderRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    CType: "header";
    header?: string;
    header_layout?: number;
    header_position?: string;
    header_link?: components["schemas"]["HeadlessLink"] | null;
    subheader?: string;
    layout?: number;
    frame_class?: string;
    space_before_class?: string;
    space_after_class?: string;
};

A file

Proofregions.main[3]

Request GET /website/_api/headless_pages/2013 #/regions/main/3 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "uid": 2204,
  "CType": "header",
  "header": "A file",
  "header_layout": 0,
  "header_position": "",
  "header_link": {
    "href": "https://typo3.example/fileadmin/website/cheat-sheet.txt",
    "target": null,
    "title": "Cheat sheet"
  },
  "subheader": "",
  "layout": 0,
  "frame_class": "default",
  "space_before_class": "",
  "space_after_class": ""
}

Generated TypeScript type

type HeadlessContentHeaderRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    CType: "header";
    header?: string;
    header_layout?: number;
    header_position?: string;
    header_link?: components["schemas"]["HeadlessLink"] | null;
    subheader?: string;
    layout?: number;
    frame_class?: string;
    space_before_class?: string;
    space_after_class?: string;
};

An e-mail address

Proofregions.main[4]

Request GET /website/_api/headless_pages/2013 #/regions/main/4 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "uid": 2205,
  "CType": "header",
  "header": "An e-mail address",
  "header_layout": 0,
  "header_position": "",
  "header_link": {
    "href": "mailto:workshop@kettenblatt.example",
    "target": null,
    "title": null
  },
  "subheader": "",
  "layout": 0,
  "frame_class": "default",
  "space_before_class": "",
  "space_after_class": ""
}

Generated TypeScript type

type HeadlessContentHeaderRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    CType: "header";
    header?: string;
    header_layout?: number;
    header_position?: string;
    header_link?: components["schemas"]["HeadlessLink"] | null;
    subheader?: string;
    layout?: number;
    frame_class?: string;
    space_before_class?: string;
    space_after_class?: string;
};

Links in rich text

Inside rich text, links are link annotations with the same properties: the navigation page, Kettenblatt's bikes in a new tab, a file and the colophon.

Only http, https, mailto and tel are kept. Anchors, record links and pages not available in the language resolve to nothing: their text stays, without a link. The colophon exists in English only, so the German version of this paragraph has no link there.

Proofregions.main[5]

Request GET /website/_api/headless_pages/2013 #/regions/main/5 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "uid": 2206,
  "CType": "text",
  "header": "Links in rich text",
  "header_layout": 0,
  "header_position": "",
  "header_link": null,
  "subheader": "",
  "bodytext": [
    {
      "_type": "block",
      "_key": "k4",
      "style": "normal",
      "markDefs": [
        {
          "_key": "k0",
          "_type": "link",
          "href": "https://typo3.example/website/features/navigation",
          "target": null,
          "title": null
        },
        {
          "_key": "k1",
          "_type": "link",
          "href": "https://typo3.example/kettenblatt/bikes",
          "target": "_blank",
          "title": null
        },
        {
          "_key": "k2",
          "_type": "link",
          "href": "https://typo3.example/fileadmin/website/cheat-sheet.txt",
          "target": null,
          "title": null
        },
        {
          "_key": "k3",
          "_type": "link",
          "href": "https://typo3.example/website/colophon",
          "target": null,
          "title": null
        }
      ],
      "children": [
        {
          "_type": "span",
          "_key": "k5",
          "marks": [],
          "text": "Inside rich text, links are "
        },
        {
          "_type": "span",
          "_key": "k6",
          "marks": [
            "code"
          ],
          "text": "link"
        },
        {
          "_type": "span",
          "_key": "k7",
          "marks": [],
          "text": " annotations with the same properties: "
        },
        {
          "_type": "span",
          "_key": "k8",
          "marks": [
            "k0"
          ],
          "text": "the navigation page"
        },
        {
          "_type": "span",
          "_key": "k9",
          "marks": [],
          "text": ", "
        },
        {
          "_type": "span",
          "_key": "k10",
          "marks": [
            "k1"
          ],
          "text": "Kettenblatt's bikes"
        },
        {
          "_type": "span",
          "_key": "k11",
          "marks": [],
          "text": " in a new tab, "
        },
        {
          "_type": "span",
          "_key": "k12",
          "marks": [
            "k2"
          ],
          "text": "a file"
        },
        {
          "_type": "span",
          "_key": "k13",
          "marks": [],
          "text": " and "
        },
        {
          "_type": "span",
          "_key": "k14",
          "marks": [
            "k3"
          ],
          "text": "the colophon"
        },
        {
          "_type": "span",
          "_key": "k15",
          "marks": [],
          "text": "."
        }
      ]
    },
    {
      "_type": "block",
      "_key": "k16",
      "style": "normal",
      "markDefs": [],
      "children": [
        {
          "_type": "span",
          "_key": "k17",
          "marks": [],
          "text": "Only http, https, mailto and tel are kept. Anchors, record links and pages not available in the language resolve to nothing: their text stays, without a link. The colophon exists in English only, so the German version of this paragraph has no link there."
        }
      ]
    }
  ],
  "layout": 0,
  "frame_class": "default",
  "space_before_class": "",
  "space_after_class": ""
}

Generated TypeScript type

type HeadlessContentTextRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    CType: "text";
    header?: string;
    header_layout?: number;
    header_position?: string;
    header_link?: components["schemas"]["HeadlessLink"] | null;
    subheader?: string;
    bodytext?: components["schemas"]["PortableText"];
    layout?: number;
    frame_class?: string;
    space_before_class?: string;
    space_after_class?: string;
};

Same API, another frontend

Fictional specimen site, rendered by the same API.

Kettenblatt: Visit

Workshop pages

menu_subpages

Find us

A hand-drawn map of the district with a river and a circle around the workshop
The brick front of the workshop with open wooden doors and two bikes outside

Opening hours

Tuesday to Saturday, 10:00 to 18:00. Write to workshop@kettenblatt.example.

ProofGET /kettenblatt/_api/headless_pages/3001

Request GET /kettenblatt/_api/headless_pages/3001 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "@type": "HeadlessPages",
  "@id": "/_api/headless_pages/3001",
  "uid": 3001,
  "title": "Visit",
  "slug": "/visit",
  "seo_title": "",
  "description": "Opening hours and how to find us.",
  "no_index": 0,
  "no_follow": 0,
  "canonical_link": null,
  "og_title": "",
  "og_description": null,
  "og_image": [],
  "breadcrumbs": [
    {
      "uid": 3000,
      "title": "Kettenblatt",
      "nav_title": "",
      "url": "https://typo3.example/kettenblatt/",
      "doktype": 1
    },
    {
      "uid": 3001,
      "title": "Visit",
      "nav_title": "",
      "url": "https://typo3.example/kettenblatt/visit",
      "doktype": 1
    }
  ],
  "languages": [
    {
      "languageId": 0,
      "locale": "en-US",
      "hreflang": "en",
      "title": "English",
      "url": "https://typo3.example/kettenblatt/visit",
      "available": true,
      "active": true
    },
    {
      "languageId": 1,
      "locale": "de-DE",
      "hreflang": "de",
      "title": "German",
      "url": "https://typo3.example/kettenblatt/de/besuch",
      "available": true,
      "active": false
    }
  ],
  "meta": {
    "robots": "index,follow",
    "canonical": "https://typo3.example/kettenblatt/visit",
    "schema": {
      "@context": "https://schema.org",
      "@type": "WebPage",
      "url": "https://typo3.example/kettenblatt/visit",
      "name": "Visit",
      "inLanguage": "en",
      "description": "Opening hours and how to find us."
    },
    "alternates": [
      {
        "hreflang": "en",
        "href": "https://typo3.example/kettenblatt/visit"
      },
      {
        "hreflang": "de",
        "href": "https://typo3.example/kettenblatt/de/besuch"
      },
      {
        "hreflang": "x-default",
        "href": "https://typo3.example/kettenblatt/visit"
      }
    ]
  },
  "regions": {
    "main": [/* 2 elements */],
    "aside": [/* 1 element */]
  }
}

Generated TypeScript type

type HeadlessPagesRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    title?: string;
    slug?: string | null;
    seo_title?: string;
    description?: string | null;
    no_index?: number;
    no_follow?: number;
    canonical_link?: components["schemas"]["HeadlessLink"] | null;
    og_title?: string;
    og_description?: string | null;
    og_image?: components["schemas"]["FileObject"][];
    breadcrumbs: components["schemas"]["HeadlessPagesBreadcrumb"][];
    languages: components["schemas"]["HeadlessPagesLanguage"][];
    meta: components["schemas"]["HeadlessPagesMeta"];
    regions: {
        [key: string]: (components["schemas"]["HeadlessContentRead"] | components["schemas"]["HeadlessContentFallbackRead"])[];
    };
    shortcut?: components["schemas"]["HeadlessPagesShortcut"] | null;
};
Proofregions.specimen[0]

Request GET /website/_api/headless_pages/2013 #/regions/specimen/0 Status 200

Recorded at build time from TYPO3 14.3. Host replaced with typo3.example; the data is unchanged. Full JSON response

JSON response

{
  "uid": 2207,
  "CType": "header",
  "header": "Kettenblatt: Visit",
  "header_layout": 0,
  "header_position": "",
  "header_link": {
    "href": "https://typo3.example/kettenblatt/visit",
    "target": null,
    "title": null
  },
  "subheader": "",
  "layout": 0,
  "frame_class": "default",
  "space_before_class": "",
  "space_after_class": ""
}

Generated TypeScript type

type HeadlessContentHeaderRead = {
    "@type"?: string;
    "@id"?: string;
    uid?: number;
    CType: "header";
    header?: string;
    header_layout?: number;
    header_position?: string;
    header_link?: components["schemas"]["HeadlessLink"] | null;
    subheader?: string;
    layout?: number;
    frame_class?: string;
    space_before_class?: string;
    space_after_class?: string;
};