---
title: "Integration"
manual: "TYPO3 REST API"
version: "5.0"
permalink: "https://docs.typo3.org/permalink/sourcebroker/t3api:integration@5.0"
source: "Integration/Index.rst"
rendered: "2026-12-02T10:02:23+00:00"
---

# Integration {#integration}

## Integration with other extensions {#integration-with-other-extensions}

Models of other extensions (e.g. `EXT:news`) can be exposed in the API without changing their code:

1.  Create a model in your extension which extends the model of the other extension and add `@T3api\ApiResource` annotation to it.
1.  Map your model to the table of the original model with Extbase persistence configuration (`Configuration/Extbase/Persistence/Classes.php`). If your class should also be returned by the original repositories and relations, register it as `subclasses` / `recordType` as described in TYPO3 documentation.
1.  Configure serialization of properties of the original class with [YAML metadata](https://docs.typo3.org/permalink/sourcebroker/t3api:serialization-yaml-metadata@5.0) \- annotations can not be added to classes you do not own.

Extbase creates related objects with the classes used in the original model (e.g. categories of a news are `\GeorgRinger\News\Domain\Model\Category`). Declare the type of such relation with your API resource class in YAML metadata - related objects are then serialized as that API resource, including its `@id`:

```yaml
GeorgRinger\News\Domain\Model\News:
  properties:
    categories:
      type: 'TYPO3\CMS\Extbase\Persistence\ObjectStorage<SourceBroker\T3apinews\Domain\Model\Category>'
```

## News extension - Example integration {#news-extension-example-integration}

Testing instance of t3api contains complete integration with `EXT:news` \- extension `t3apinews` (see `.ddev/test/files/src/t3apinews` in t3api repository). It is a good starting point for your own integration:

-   `Classes/Domain/Model/News.php`, `Category.php`, `Tag.php` \- API resources extending `EXT:news` models, with operations and [filters](https://docs.typo3.org/permalink/sourcebroker/t3api:filtering@5.0).
-   `Classes/Domain/Model/File.php` \- resource used for [file upload](https://docs.typo3.org/permalink/sourcebroker/t3api:handling-file-upload@5.0).
-   `Configuration/Extbase/Persistence/Classes.php` \- mapping of the models to `EXT:news` tables.
-   `Resources/Private/Serializer/GeorgRinger.News/*.yml` \- [YAML metadata](https://docs.typo3.org/permalink/sourcebroker/t3api:serialization-yaml-metadata@5.0) with serialization groups for `EXT:news` models, registered in `ext_localconf.php`.

**EXT:t3apinews/Configuration/Extbase/Persistence/Classes.php**

```php
use SourceBroker\T3apinews\Domain\Model\Category;
use SourceBroker\T3apinews\Domain\Model\News;
use SourceBroker\T3apinews\Domain\Model\Tag;

return [
    News::class => [
        'tableName' => 'tx_news_domain_model_news',
    ],
    Tag::class => [
        'tableName' => 'tx_news_domain_model_tag',
    ],
    Category::class => [
        'tableName' => 'sys_category',
    ],
];
```

> **Real examples. Run "ddev restart && ddev ci 14" and try those links below.**
>
> -   News, categories and tags of `EXT:news` exposed by `t3apinews`:\
>     [https://14.t3api.ddev.site/\_api/news/news](https://14.t3api.ddev.site/_api/news/news)\
>     [https://14.t3api.ddev.site/\_api/news/categories](https://14.t3api.ddev.site/_api/news/categories)\
>     [https://14.t3api.ddev.site/\_api/news/tags](https://14.t3api.ddev.site/_api/news/tags)\

## Inline output {#inline-output}

If you would like to include API response directly in TYPO3 HTML output (e.g. to avoid waiting for initial request
to the API in your frontend application) you can use `t3api:inline` ViewHelper. It processes the request internally,
without HTTP request, and returns the same JSON which would be returned by the endpoint.

Arguments:

-   `route` (`string`, required) - path of the endpoint, without API base path, e.g. `news/news` or `news/news/1`.
-   `params` (`array`) - query params, e.g. filters: `{search: 'minima', order: {title: 'asc'}}`.
-   `itemsPerPage` (`int`) - number of items per page (sent as `itemsPerPage` param).
-   `page` (`int`) - page number (sent as `page` param).

```html
<html xmlns:t3api="http://typo3.org/ns/SourceBroker/T3api/ViewHelpers"
      data-namespace-typo3-fluid="true">

    <script type="application/json" id="initial-news">
        <f:format.raw><t3api:inline route="news/news" params="{istopnews: 'true'}" itemsPerPage="10" /></f:format.raw>
    </script>

</html>
```

> [!IMPORTANT]
> Output of the ViewHelper is HTML-escaped by Fluid, so wrap it in `<f:format.raw>` when it is placed inside `<script>`.
> `itemsPerPage` and `page` arguments use global names of the params (`itemsPerPage` and `page`). If you changed
> the names for a resource, pass them in `params` instead. `itemsPerPage` is respected only if
> `pagination_client_items_per_page` is enabled (see [Pagination](https://docs.typo3.org/permalink/sourcebroker/t3api:pagination@5.0)).
