---
title: "Anatomy of the Data Array"
manual: "Interest"
version: "4.1"
source: "Implementing/DataArray/Index.rst"
rendered: "2026-09-18T11:09:59+00:00"
---

# Anatomy of the Data Array {#implementing-data}

The data array is the representation of a single record in the database.

-   [The record data](#the-record-data)
-   [Single-record requests](#single-record-requests)
-   [Batch requests](#batch-requests)

## The record data {#implementing-data-record}

### Simple fields {#implementing-data-record-simple}

Each record's data is represented as an associative array, where the key is a
database field name and the value is the value of the field.

This example has data for two fields, `title` and `subtitle`:

```json
{
   "title": "1998 - the First Public Appearance",
   "subtitle": "TYPO3 was first presented at IFRA in Lyon, France"
}
```

### Relation fields {#implementing-data-record-relation}

Fields can also represent relations to one or more other records.

These records are represented by the record's [remote ID](../../Introduction/Index.html#what-it-does-remote-ids),
and never by their UID in the database. If a record wasn't created by this
extension, you will have to create the remote ID manually.

The extension will automatically detect if a field is a relation field and treat
the value as a remote ID.

> [!NOTE]
> **No error will be issued if a remote ID does not exist.** Instead, the
> relation will be [deferred](../../Introduction/Index.html#what-it-does-track-relations-and-defer).
> It will be inserted only when the the record on the other side of the
> relation — and its remote ID — is created.

> [!NOTE]
> **Missing required relations may lead to :ref:\`deferred \<what-it-does-track-relations-and-defer>\`
> record insert.** If a remote ID is required and doesn't exist, a record that
> depends on it may not be inserted until the required relation is created.
> For example, a subpage will only be created when its parent page has been
> created.

#### Single relation {#implementing-data-record-single-relation}

In this example the `pid` is set to the remote ID `siteRootPage`:

```json
{
   "title": "Test Name",
   "pid": "siteRootPage"
}
```

#### Multiple relations {#implementing-data-record-multi-relation}

Multiple relations are defined as an array of remote IDs. The array can only be
numeric and must not be associative.

This example defines relations to three image files:

```json
{
   "images": [
      "FileReference-1",
      "FileReference-2",
      "FileReference-3"
   ]
}
```

> [!TIP]
> Relations to image files are usually created through relations to the
> `sys_file_reference` table that again reference files in the `sys_file`
> table. You must therefore create both of these records too. See
> [File Handling](../FileHandling/Index.html#implementing-files)

> [!NOTE]
> The extension tracks the intended order of relations. If `FileReference-2`
> is created before `FileReference-1`, it will maintain the order of the
> relations so `FileReference-1` is listed before `FileReference-2`.

## Single-record requests {#implementing-data-single}

The simplest requests contain data for just a single record:

```json
{
   "title": "Test Name",
   "pid": "siteRootPage"
}
```

#### Example for REST or Reaction requests {#implementing-data-single-rest-reaction}

For a [REST](../Rest/Index.html#implementing-rest) or [Reaction](../Webhook/Index.html#reaction) request,
this is assigned to the `data` property:

```json
{
   "data": {
      "title": "Test Name",
      "pid": "siteRootPage"
   }
}
```

#### Example for a CLI command {#implementing-data-single-cli}

For a [CLI](../Cli/Index.html#implementing-cli) command, it is what you set using the
`--data` (`-d`) option or pipe:

```bash
# These commands have identical results.

typo3 interest:create ... --data='{"title":"Test Name","pid":"siteRootPage"}'

echo -n '{"title":"Test Name","pid":"siteRootPage"}' | typo3 interest:create ...
```

## Batch requests {#implementing-data-batch}

`[table]` and `[remoteId]` must be supplied, but can be a part of the `[data]`
array. This makes it possible to supply batch data affecting multiple records
and tables.

Given a request with only `[table]` supplied in the URL:

```text
http://www.example.org/[endpoint]/[table]
```

### Multiple records in the same table {#implementing-data-batch-same-table}

You can insert or update multiple records within `[table]`. Your data array
could look something like this:

```json
{
   "Record-1": {
      "title": "My first record",
      "page": ["Page-916"]
   },
   "Record-2": {
      "title": "My second record",
      "page": ["Page-376"]
   }
}
```

#### Example for REST or Reaction requests {#implementing-data-batch-same-table-rest-reaction}

For a [REST](../Rest/Index.html#implementing-rest) or [Reaction](../Webhook/Index.html#reaction) request,
this is assigned to the `data` property:

```json
{
   "data": {
      "Record-1": { ... },
      "Record-2": { ... }
   }
}
```

#### Example for a CLI command {#implementing-data-batch-same-table-cli}

For a [CLI](../Cli/Index.html#implementing-cli) command, it is what you set using the
`--data` (`-d`) option or pipe:

```bash
# These commands have identical results.

typo3 interest:create ... --data='{"Record-1":{ ... },"Record-2":{ ... }}'

echo -n '{"Record-1":{ ... },"Record-2":{ ... }}' | typo3 interest:create ...
```

### Multiple records in multiple tables {#implementing-data-batch-multitable}

You can also leave out the table and insert or update multiple records within
multiple tables:

```json
"pages": {
   "Page-1": {
      "title": "My first page"
   },
   "Page-2": {
      "title": "My second page"
   }
},
"tt_content": {
   "Content-1": {
      "heading": "Welcome to the first page",
      "pid": "Page-1"
   },
   "Content-2": {
      "heading": "Welcome to the second page",
      "pid": "Page-2"
   }
}
```

#### Example for REST or Reaction requests {#implementing-data-batch-multitable-rest-reaction}

For a [REST](../Rest/Index.html#implementing-rest) or [Reaction](../Webhook/Index.html#reaction) request,
this is assigned to the `data` property:

```json
{
   "data": {
      "pages": { ... },
      "tt_content": { ... }
   }
}
```

#### Example for a CLI command {#implementing-data-batch-multitable-cli}

For a [CLI](../Cli/Index.html#implementing-cli) command, it is what you set using the
`--data` (`-d`) option or pipe:

```bash
# These commands have identical results.

typo3 interest:create ... --data='{"pages":{ ... },"tt_content":{ ... }}'

echo -n '{"pages":{ ... },"tt_content":{ ... }}' | typo3 interest:create ...
```

### Multilingual records {#implementing-data-multilingual}

It is even possible to insert records in multiple languages by adding a language
layer to the data:

```json
"pages": {
   "Page-1": {
      "en": {
         "title": "My first page"
      },
      "nb": {
         "title": "Min første side"
      }
   },
   "Page-2": {
      "en": {
         "title": "My second page"
      }
   },
},
"tt_content": {
   "Content-1": {
      "en": {
         "heading": "Welcome to the first page",
         "pid": "Page-1"
      },
      "nb" {
         "heading": "Velkommen til den første siden",
         "pid": "Page-1"
      }
   },
}
```

#### Example for REST or Reaction requests {#implementing-data-multilingual-rest-reaction}

For a [REST](../Rest/Index.html#implementing-rest) or [Reaction](../Webhook/Index.html#reaction) request,
this is assigned to the `data` property:

```json
{
   "data": {
      "pages": { ... },
      "tt_content": { ... }
   }
}
```

#### Example for a CLI command {#implementing-data-multilingual-cli}

For a [CLI](../Cli/Index.html#implementing-cli) command, it is what you set using the
`--data` (`-d`) option or pipe:

```bash
# These commands have identical results.

typo3 interest:create ... --data='{"pages":{ ... },"tt_content":{ ... }}'

echo -n '{"pages":{ ... },"tt_content":{ ... }}' | typo3 interest:create ...
```
