> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# API reference data feeds

> Build, edit, and delete product data feeds and feed templates via the Admin Interface API for search engines and external marketing services.

Data feeds make it possible to provide product data from a WEBSALE shop for external systems such as search engines, search service providers, etc. The `datafeeds/` endpoint allows you to manage your data feeds. With this interface, you can update and delete already created feeds or create new data feeds.

***

## Supported methods

List of all supported methods.

| **Command/info**        | **Endpoints**       | **GET**               | **POST**              | **PUT**               | **DELETE**            |
| ----------------------- | ------------------- | --------------------- | --------------------- | --------------------- | --------------------- |
| **Data feeds**          | datafeeds/          | <Icon icon="check" /> | <Icon icon="check" /> | <Icon icon="check" /> | <Icon icon="check" /> |
| **Data feed templates** | datafeeds/templates | <Icon icon="check" /> | <Icon icon="check" /> | <Icon icon="check" /> | <Icon icon="check" /> |
| **Generation**          | datafeeds/build     | <Icon icon="check" /> | <Icon icon="check" /> | <Icon icon="ban" />   | <Icon icon="ban" />   |

## Data fields of a data feed

| **Name**                                  | **Type** | **Usage**                                                                                                              |
| ----------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| **active**                                | Boolean  | Indicates whether the data feed is enabled for export                                                                  |
| **createdAt**                             | String   | Time at which the data feed was created (ISO 8601 format, UTC).                                                        |
| **exportPlanOptions.exportAfterImport**   | Boolean  | Indicates whether the data feed is automatically exported after an import process.                                     |
| **exportPlanOptions.exportPlan**          | Array    | List of hours at which an export is scheduled.                                                                         |
| **exportStatus**                          | String   | Status of the last export: <br /> `"idle"` <br /> `"starting"` <br /> `"running"` <br /> `"finished"` <br /> `"error"` |
| **externalOutputTarget.host**             | String   | Hostname or IP address of the external target system                                                                   |
| **externalOutputTarget.password**         | String   | Password for access to the target system                                                                               |
| **externalOutputTarget.port**             | Integer  | Port number of the external target system (e.g. 21 for FTP)                                                            |
| **externalOutputTarget.remotePath**       | String   | Target directory on the external server                                                                                |
| **externalOutputTarget.type**             | String   | Type of the target system (e.g. "ftp", "sftp", "none")                                                                 |
| **externalOutputTarget.user**             | String   | User name for the target system.                                                                                       |
| **fileName**                              | String   | Name of the file generated during export.                                                                              |
| **id**                                    | Integer  | Unique ID of the data feed.                                                                                            |
| **lastExportFinished**                    | String   | Time at which the last successful export was completed (ISO 8601 format, UTC).                                         |
| **lastExportStarted**                     | String   | Time at which the last export was started (ISO 8601 format, UTC).                                                      |
| **name**                                  | String   | Name of the data feed.                                                                                                 |
| **options.exportCharset**                 | String   | Character set for the exported file (e.g. "utf-8")                                                                     |
| **options.webhookTrigger**                | String   | Webhook triggered after export (optional)                                                                              |
| **options.webhookTriggerOptions**         | Object   | Options for the webhook trigger (optional)                                                                             |
| **options.webhookTriggerOptions.headers** | Object   | HTTP header parameters as key-value pairs                                                                              |
| **options.webhookTriggerOptions.type**    | String   | Type of the webhook                                                                                                    |
| **options.zipType**                       | String   | Compression type for export file (`"none"`, `"zip"`, `"gzip"`)                                                         |
| **saveTarget**                            | String   | Storage target of the export: <br /> `"contentData"` – publicly accessible <br /> `"system"` – not publicly accessible |
| **subshopIds**                            | Array    | List of subshops for which the data feed is active.                                                                    |
| **targetDirectory**                       | String   | Target directory in which the exported file is saved (overrides the template's default target if applicable).          |
| **templateId**                            | Integer  | ID of the template on which the data feed is based.                                                                    |
| **templateName**                          | String   | Name of the template of the data feed. Only returned in the list view (GET datafeeds).                                 |
| **updatedAt**                             | String   | Time of the last update of the data feed (ISO 8601 format, UTC).                                                       |

#### Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "active": true,
    "createdAt": "2025-03-24 16:34:58",
    "exportPlanOptions": {
        "exportAfterImport": true,
        "exportPlan": [
            0,
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23
        ]
    },
    "exportStatus": "finished",
    "externalOutputTarget": {
        "host": "",
        "password": "",
        "port": 21,
        "remotePath": "",
        "type": "none",
        "user": ""
    },
    "fileName": "test",
    "id": 226,
    "lastExportFinished": "2025-04-09 11:31:51",
    "lastExportStarted": "2025-04-09 11:31:46",
    "name": "test",
    "options": {
        "exportCharset": "utf-8",
        "webhookTrigger": "",
        "webhookTriggerOptions": {
            "headers": {},
            "type": ""
        },
        "zipType": "zip"
    },
    "saveTarget": "contentData",
    "subshopIds": [
        "deutsch"
    ],
    "targetDirectory": "/test",
    "templateId": 226,
    "updatedAt": "2025-03-25 11:21:56"
}
```

### Data feed templates

| **Name**      | **Type** | **Usage**                                                                                                  |
| ------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| **id**        | Integer  | Unique ID of the data feed template                                                                        |
| **name**      | String   | Name of the data feed template                                                                             |
| **content**   | String   | The content of the template. The template language may be used here.                                       |
| **createdAt** | String   | Time of creation                                                                                           |
| **updatedAt** | String   | Time of the last update                                                                                    |
| **usedBy**    | Array    | List of names of data feeds using this template. Only returned in the list view (GET datafeeds/templates). |

#### Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "content": "<products>\n{{ \n  var $product = true;\n  while($product);\n  $product = $wsProducts.loadNext() }}<product>\n   <id>{{= $product.id }}</id>\n   <name>{{= $product.name }}</name>\n   <url>{{= $wsViews.url('Product', {productId: $product.id}, 'absolute') }}</url>\n  </product>{{ /while }}\n</products>",
    "createdAt": "2025-04-30 14:28:58",
    "id": 4,
    "name": "productsAsXML",
    "updatedAt": "2025-04-30 14:41:14"
}
```

## Methods for data feeds

This section describes all endpoints for managing data feeds in the shop system. The interface can be used to create, retrieve, update, delete, and schedule exports of data feeds.

### GET datafeeds

This method returns a paginated list of all data feeds present in the system.\
By default, 100 entries are returned per request.

The optional `size` parameter can be used to adjust the number of returned records — up to a maximum value of 300. The `size` value can be freely chosen between 1 and 300.\
The result list can be specifically restricted and ordered via defined filter and sort parameters.

Read permissions for data feeds are required to access.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "endReached": true,
    "items": [
        {
            "active": true,
            "createdAt": "2025-02-17 10:30:40",
            ...
            "templateName": "myTemplate",
            ...
        },
        ...
    ],
    "nextPageToken": "MA",
    "totalCount": 1
}
```

#### Filter fields

`id`, `active`, `name`, `fileName`, `templateId`, `subshopIds`, `targetDirectory`, `exportStatus`, `lastExportStarted`, `lastExportFinished`, `createdAt`, `updatedAt`

#### Sort fields

`id`, `active`, `name`, `fileName`, `templateId`, `subshopIds`, `exportStatus`, `lastExportStarted`, `lastExportFinished`, `createdAt`, `updatedAt`

#### Error codes

| **Error**        | **Type**            | **Reason**                                                   |
| ---------------- | ------------------- | ------------------------------------------------------------ |
| 401 Unauthorized |                     | Not authorized: you are not logged in.                       |
| 403 Forbidden    |                     | You do not have the required permissions to read data feeds. |
| 400 Bad Request  | "invalidValue"      |                                                              |
| 400 Bad Request  | "invalidCharacters" | `size` is not an integer.<br />A filter value is invalid.    |
| 400 Bad Request  | "unknownDataField"  | A filter or sort field is invalid.                           |
| 400 Bad Request  | "unknownOperation"  | A filter type is invalid.                                    |
| 400 Bad Request  | "syntaxError"       | `sort` contains more than one or no ":".                     |

### GET datafeeds/\{id}

This method retrieves the complete details of a single data feed by its unique ID.

The endpoint returns all configured properties of the data feed, including name, export options, directory information, and status information. Access requires the appropriate read permission for data feeds.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/2
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "active": true,
    "createdAt": "2025-02-17 10:30:40",
    "exportPlanOptions": {
        "exportAfterImport": false,
        "exportPlan": []
    },
    "exportStatus": "idle",
    "externalOutputTarget": {
        "host": "",
        "password": "",
        "port": 21,
        "remotePath": "",
        "type": "none",
        "user": ""
    },
    "fileName": "foo",
    "id": 1,
    "lastExportFinished": "0000-00-00 00:00:00",
    "lastExportStarted": "0000-00-00 00:00:00",
    "name": "myDataFeed",
    "options": {
        "exportCharset": "utf-8",
        "webhookTrigger": "",
        "webhookTriggerOptions": {
            "headers": {},
            "type": ""
        },
        "zipType": "zip"
    },
    "saveTarget": "system",
    "subshopIds": [
        "deutsch",
        "english"
    ],
    "targetDirectory": "/bar",
    "templateId": 1,
    "updatedAt": "2025-02-17 10:30:40"
}
```

#### Error codes

| **Error**        | **Type**       | **Reason**                                                   |
| ---------------- | -------------- | ------------------------------------------------------------ |
| 401 Unauthorized |                | Not authorized: you are not logged in.                       |
| 403 Forbidden    |                | You do not have the required permissions to read data feeds. |
| 400 Bad Request  | "invalidValue" | `id` is invalid.                                             |
| 404 Not Found    |                | Data feed with `id`=`{id}` was not found.                    |

### PUT datafeeds/\{id}

This method updates an existing data feed by its unique ID. Data remains unchanged until generation.

In the request body, various properties of the data feed can be changed, including name, status, file name, export options, and target directories. The fields `createdAt`, `updatedAt`, `lastExportStarted`, `lastExportFinished`, and `exportStatus` can be passed, but are ignored by the system and not overwritten.

The updated data feed is returned as a JSON object in the response.

Write permissions are required for execution.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/1
```

#### Request body

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "name": "newName",
    "active": true,
    "templateId": 1,
    "saveTarget": "system",
    "fileName": "foo",
    "targetDirectory": "/bar",
    "subshopIds": [
        "deutsch",
        "english"
    ],
    "options": {
        "zipType": "zip"
    },
    "exportPlanOptions": {
        "exportAfterImport": false,
        "exportPlan": []
    },
    "externalOutputTarget": {
        "type": "none",
        "host": "",
        "port": 21,
        "user": "",
        "password": "",
        "remotePath": ""
    }
}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "active": true,
    "createdAt": "2025-02-17 10:30:40",
    "exportPlanOptions": {
        "exportAfterImport": false,
        "exportPlan": []
    },
    "exportStatus": "finished",
    "externalOutputTarget": {
        "host": "",
        "password": "",
        "port": 21,
        "remotePath": "",
        "type": "none",
        "user": ""
    },
    "fileName": "foo",
    "id": 1,
    "lastExportFinished": "2025-02-17 14:31:57",
    "lastExportStarted": "2025-02-17 14:31:52",
    "name": "newName",
    "options": {
        "exportCharset": "utf-8",
        "webhookTrigger": "",
        "webhookTriggerOptions": {
            "headers": {},
            "type": ""
        },
        "zipType": "zip"
    },
    "saveTarget": "system",
    "subshopIds": [
        "deutsch",
        "english"
    ],
    "targetDirectory": "/bar",
    "templateId": 1,
    "updatedAt": "2025-05-02 09:54:52"
}
```

#### Error codes

| **Error**        | **Type**             | **Reason**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 401 Unauthorized |                      | Not authorized: you are not logged in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 403 Forbidden    |                      | You do not have the required permissions to write data feeds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 400 Bad Request  |                      | Request body could not be loaded.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 400 Bad Request  | "invalidCombination" | If `active=true` applies, `templateId` cannot be 0 (default value).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 400 Bad Request  |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 400 Bad Request  | "invalidCharacters"  | `fileName` contains `/`, `\`, or `:`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 400 Bad Request  | "invalidFormat"      | `name`, `fileName`, `targetDirectory`, or `saveTarget` are not strings<br />`active` is not a boolean<br />`templateId` is not an integer<br />`subshopIds` is not an array of strings<br />`options` is not an object<br />`options.zipType`, `options.exportCharset`, or `options.webhookTrigger` are not strings<br />`options.webhookTriggerOptions` is not an object<br />`options.webhookTriggerOptions.type` is not a string<br />`options.webhookTriggerOptions.headerParams` is not an array<br />An element of `options.webhookTriggerOptions.headerParams` is not an object, or `key` or `value` therein is not a string<br />`externalOutputTarget` is not an object<br />`externalOutputTarget.type`, `externalOutputTarget.host`, `externalOutputTarget.user`, `externalOutputTarget.password`, or `externalOutputTarget.remotePath` are not strings<br />`externalOutputTarget.port` is not a number<br />`exportPlanOptions` is not an object<br />`exportPlanOptions.exportAfterImport` is not a boolean<br />`exportPlanOptions.exportPlan` is not an array. |
| 400 Bad Request  | "unknownDataField"   | `options` contains something other than `zipType`, `exportCharset`, `webhookTrigger`, or `webhookTriggerOptions`.<br />`options.webhookTriggerOptions` contains something other than `type` or `headerParams`.<br />An element of `options.webhookTriggerOptions.headerParams` contains something other than `key` or `value`.<br />`externalOutputTarget` contains something other than `type`, `host`, `port`, `user`, `password`, or `remotePath`.<br />`exportPlanOptions` contains something other than `exportAfterImport` or `exportPlan`.<br />The request body contains an unknown field.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 404 Not Found    |                      | Data feed with `id`=`{id}` was not found.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 409 Conflict     |                      | The update failed.<br />The file path is already in use.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

### POST datafeeds

This method creates a new data feed.

The properties of the data feed, such as name, status, file name, export options, and target directories, are defined via the request body. The fields `createdAt`, `updatedAt`, `lastExportStarted`, `lastExportFinished`, and `exportStatus` can be passed but are ignored by the system and set automatically.

After successful creation, the complete data feed is returned as a JSON object.

Execution requires create permissions.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds
```

#### Request body

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "name": "myFeed",
    "active": true,
    "templateId": 4,
    "saveTarget": "system",
    "fileName": "myFeed.csv",
    "targetDirectory": "/abc",
    "subshopIds": [
        "deutsch",
        "english"
    ],
    "options": {
        "zipType": "zip"
    },
    "exportPlanOptions": {
        "exportAfterImport": false,
        "exportPlan": []
    },
    "externalOutputTarget": {
        "type": "none",
        "host": "",
        "port": 21,
        "user": "",
        "password": "",
        "remotePath": ""
    }
}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "active": true,
    "createdAt": "2025-04-30 14:28:59",
    "exportPlanOptions": {
        "exportAfterImport": false,
        "exportPlan": []
    },
    "exportStatus": "idle",
    "externalOutputTarget": {
        "host": "",
        "password": "",
        "port": 21,
        "remotePath": "",
        "type": "none",
        "user": ""
    },
    "fileName": "myFeed.csv",
    "id": 5,
    "lastExportFinished": "0000-00-00 00:00:00",
    "lastExportStarted": "0000-00-00 00:00:00",
    "name": "myFeed",
    "options": {
        "exportCharset": "utf-8",
        "webhookTrigger": "",
        "webhookTriggerOptions": {
            "headers": {},
            "type": ""
        },
        "zipType": "zip"
    },
    "saveTarget": "system",
    "subshopIds": [
        "deutsch",
        "english"
    ],
    "targetDirectory": "/abc",
    "templateId": 4,
    "updatedAt": "2025-04-30 14:28:59"
}
```

#### Error codes

| **Error**        | **Type**            | **Reason**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 401 Unauthorized |                     | Not authorized: you are not logged in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 403 Forbidden    |                     | You do not have the required permissions to create data feeds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 400 Bad Request  |                     | Request body could not be loaded.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 400 Bad Request  | "invalidValue"      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 400 Bad Request  | "invalidCharacters" | `fileName` contains `/`, `\`, or `:`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 400 Bad Request  | "invalidFormat"     | `name`, `fileName`, `targetDirectory`, or `saveTarget` are not strings<br />`active` is not a boolean<br />`templateId` is not an integer<br />`subshopIds` is not an array of strings<br />`options` is not an object<br />`options.zipType`, `options.exportCharset`, or `options.webhookTrigger` are not strings<br />`options.webhookTriggerOptions` is not an object<br />`options.webhookTriggerOptions.type` is not a string<br />`options.webhookTriggerOptions.headerParams` is not an array<br />An element of `options.webhookTriggerOptions.headerParams` is not an object, or `key` or `value` therein is not a string<br />`externalOutputTarget` is not an object<br />`externalOutputTarget.type`, `externalOutputTarget.host`, `externalOutputTarget.user`, `externalOutputTarget.password`, or `externalOutputTarget.remotePath` are not strings<br />`externalOutputTarget.port` is not a number<br />`exportPlanOptions` is not an object<br />`exportPlanOptions.exportAfterImport` is not a boolean<br />`exportPlanOptions.exportPlan` is not an array. |
| 400 Bad Request  | "unknownDataField"  | `options` contains something other than `zipType`, `exportCharset`, `webhookTrigger`, or `webhookTriggerOptions`.<br />`options.webhookTriggerOptions` contains something other than `type` or `headerParams`.<br />An element of `options.webhookTriggerOptions.headerParams` contains something other than `key` or `value`.<br />`externalOutputTarget` contains something other than `type`, `host`, `port`, `user`, `password`, or `remotePath`.<br />`exportPlanOptions` contains something other than `exportAfterImport` or `exportPlan`.<br />The request body contains an unknown field.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 409 Conflict     |                     | The creation failed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

### DELETE datafeeds/\{id}

This method permanently deletes an existing data feed by its unique ID.

Access to this endpoint requires delete permissions.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/5
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{"success": true}
```

#### Error codes

| **Error**        | **Type**       | **Reason**                                                     |
| ---------------- | -------------- | -------------------------------------------------------------- |
| 401 Unauthorized |                | Not authorized: you are not logged in.                         |
| 403 Forbidden    |                | You do not have the required permissions to delete data feeds. |
| 400 Bad Request  | "invalidValue" | `id` is invalid.                                               |
| 404 Not Found    |                | Data feed with `id`=`{id}` was not found.                      |

## Methods for data feed templates

This section describes the endpoints for managing templates for data feeds. Templates define the structure and the fields contained in a data feed, such as product data, category data, or further information.

Before creating a data feed, a suitable template must be created, since this forms the basis for the later export.

### GET datafeeds/templates

This method returns a paginated list of all data feed templates present in the system.

The result list can be restricted and sorted via filter and sort parameters. The templates form the basis for later data feed creation.

Access to this endpoint requires read permissions for data feeds.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/templates
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "endReached": true,
    "items": [
        {
            "content": "tre",
            "createdAt": "2025-02-14 11:11:53",
            "id": 1,
            "name": "myTemplate",
            "updatedAt": "2025-02-14 11:11:53",
            "usedBy": [
                "myDataFeed"
            ]
        },
        ...
    ],
    "nextPageToken": "MA",
    "totalCount": 1
}
```

#### Filter fields

`id`, `name`, `content`, `createdAt`, `updatedAt`

#### Sort fields

`id`, `name`, `content`, `createdAt`, `updatedAt`

#### Error codes

| **Error**        | **Type**            | **Reason**                                                                  |
| ---------------- | ------------------- | --------------------------------------------------------------------------- |
| 401 Unauthorized |                     | You are not an administrator and do not have permission to read data feeds. |
| 400 Bad Request  | "invalidValue"      | `size` ∉ \[1;300] <br /> `pageToken` is not a number or is less than 0.     |
| 400 Bad Request  | "invalidCharacters" | `size` is not an integer. <br /> A filter value is invalid.                 |
| 400 Bad Request  | "unknownDataField"  | A filter or sort field is invalid.                                          |
| 400 Bad Request  | "unknownOperation"  | A filter type is invalid.                                                   |
| 400 Bad Request  | "syntaxError"       | `sort` contains more than one or no ":".                                    |

### GET datafeeds/templates/\{id}

This method retrieves the complete details of a single data feed template by its unique ID. The response contains the master data of the template and its content definition.

Access to this endpoint requires read permissions for data feeds.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/templates/1234567
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "content": "something",
    "createdAt": "2025-02-14 11:11:53",
    "id": 1,
    "name": "myTemplate",
    "updatedAt": "2025-02-14 11:11:53"
}
```

#### Error codes

| **Error**        | **Type**       | **Reason**                                                   |
| ---------------- | -------------- | ------------------------------------------------------------ |
| 401 Unauthorized |                | Not authorized: you are not logged in.                       |
| 403 Forbidden    |                | You do not have the required permissions to read data feeds. |
| 400 Bad Request  | "invalidValue" | `id` is invalid.                                             |
| 404 Not Found    |                | The template with `id`=`{id}` was not found.                 |

### PUT datafeeds/templates/\{id}

This method updates an existing data feed template by its unique ID.

In the request body, the name and the content (`content`) of the template can be changed. The fields `createdAt` and `updatedAt` can be passed, but are automatically managed by the system and not overwritten.

After successful update, the complete template is returned in the response. Write permissions are required.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/templates/3
```

#### Request body

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "name": "productsAsXML",
    "content": "<products>\n{{ \n  var $product = true;\n  while($product);\n  $product = $wsProducts.loadNext() }}<product>\n   <id>{{= $product.id }}</id>\n   <name>{{= $product.name }}</name>\n   <url>{{= $wsViews.url('Product', {productId: $product.id}, 'absolute') }}</url>\n  </product>{{ /while }}\n</products>"
}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "content": "<products>\n{{ \n  var $product = true;\n  while($product);\n  $product = $wsProducts.loadNext() }}<product>\n   <id>{{= $product.id }}</id>\n   <name>{{= $product.name }}</name>\n   <url>{{= $wsViews.url('Product', {productId: $product.id}, 'absolute') }}</url>\n  </product>{{ /while }}\n</products>",
    "createdAt": "2025-04-30 14:28:58",
    "id": 4,
    "name": "productsAsXML",
    "updatedAt": "2025-04-30 14:41:14"
}
```

#### Error codes

| **Error**        | **Type**           | **Reason**                                                                                  |
| ---------------- | ------------------ | ------------------------------------------------------------------------------------------- |
| 401 Unauthorized |                    | Not authorized: you are not logged in.                                                      |
| 403 Forbidden    |                    | You do not have the required permissions to write data feeds.                               |
| 400 Bad Request  |                    | Request body could not be loaded.                                                           |
| 400 Bad Request  | "invalidValue"     | `id` is invalid. `content` could not be compiled.                                           |
| 400 Bad Request  | "invalidFormat"    | `name` or `content` are not strings                                                         |
| 400 Bad Request  | "unknownDataField" | The request body contains something other than `name`, `content`, `createdAt`, `updatedAt`. |
| 409 Conflict     |                    | The update failed.                                                                          |
| 404 Not found    |                    | The template was not found.                                                                 |

### POST datafeeds/templates

This method creates a new data feed template in the system.

In the request body, the name of the template and its content (`content`) must be provided. The fields `createdAt` and `updatedAt` can be passed, but are automatically set by the system and not accepted.

After successful creation, the complete template with all related information is returned as a JSON object.

Create permissions are required.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/templates
```

#### Request body

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "name": "myNewTemplate",
    "content": "id,name,url\n{{ var $product = true }}\n{{ while($product) }}\n{{ $product = $wsProducts.loadNext() }}\n{{= $product.id }}, {{= $product.name }}, {{= $wsViews.url('Product', {productId: $product.id}, 'absolute') }}\n{{ /while }}"
}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "content": "id,name,url\n{{ var $product = true }}\n{{ while($product) }}\n{{ $product = $wsProducts.loadNext() }}\n{{= $product.id }}, {{= $product.name }}, {{= $wsViews.url('Product', {productId: $product.id}, 'absolute') }}\n{{ /while }}",
    "createdAt": "2025-04-30 14:28:58",
    "id": 4,
    "name": "myNewTemplate",
    "updatedAt": "2025-04-30 14:28:58"
}
```

#### Error codes

| **Error**        | **Type**           | **Reason**                                                                                  |
| ---------------- | ------------------ | ------------------------------------------------------------------------------------------- |
| 401 Unauthorized |                    | Not authorized: you are not logged in.                                                      |
| 403 Forbidden    |                    | You do not have the required permissions to create data feeds.                              |
| 400 Bad Request  |                    | Request body could not be loaded.                                                           |
| 400 Bad Request  | "invalidFormat"    | `name` or `content` are not strings.                                                        |
| 400 Bad Request  | "missing"          | `name` or `content` is missing.                                                             |
| 400 Bad Request  | "unknownDataField" | The request body contains something other than `name`, `content`, `createdAt`, `updatedAt`. |
| 400 Bad Request  | "invalidValue"     | `name` or `content` is empty. `content` could not be compiled.                              |
| 409 Conflict     |                    | The creation failed.                                                                        |

### POST datafeeds/templates/validate

This method checks whether the provided content (`content`) of a data feed template is syntactically correct.

Possible formatting errors or invalidities are detected before a template is saved or used. The request body must contain the `content` field as a string. The validation does not save any data; it serves exclusively for the check.

Read permissions for data feeds are required.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/templates/validate
```

#### Request body

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "content": "<products>\n{{ \n  var $product = true;\n  while($product);\n  $product = $wsProducts.loadNext() }}<product>\n   <id>{{= $product.id }}</id>\n   <name>{{= $product.name }}</name>\n   <url>{{= $wsViews.url('Product', {productId: $product.id}, 'absolute') }}</url>\n  </product>{{ /while }}\n</products>"
}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "error": {
        "compilerErrors": [],
        "dependenciesError": false
    },
    "valid": true
}
```

#### Error codes

| **Error**        | **Type**           | **Reason**                                                   |
| ---------------- | ------------------ | ------------------------------------------------------------ |
| 401 Unauthorized |                    | Not authorized: you are not logged in.                       |
| 403 Forbidden    |                    | You do not have the required permissions to read data feeds. |
| 400 Bad Request  |                    | Request body could not be loaded.                            |
| 400 Bad Request  | "invalidFormat"    | `content` is not a string.                                   |
| 400 Bad Request  | "missing"          | `content` is missing.                                        |
| 400 Bad Request  | "unknownDataField" | The request body contains an unknown field.                  |

### DELETE datafeeds/templates/\{id}

This method deletes an existing data feed template by its unique ID.

The successful deletion is confirmed by the JSON object `{"success": true}` and the status code. A template can only be deleted if it is no longer in use.

Delete permissions are required for access to this endpoint.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/templates/4
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{"success": true}
```

#### Error codes

| **Error**        | **Type**       | **Reason**                                                     |
| ---------------- | -------------- | -------------------------------------------------------------- |
| 401 Unauthorized |                | Not authorized: you are not logged in.                         |
| 403 Forbidden    |                | You do not have the required permissions to delete data feeds. |
| 400 Bad Request  | "invalidValue" | `id` is invalid.                                               |
| 409 Conflict     |                | The template is still in use.                                  |
| 404 Not Found    |                | The template with `id`=`{id}` was not found.                   |

## Methods for building data feeds

This section describes all endpoints that control the build process of data feeds. The interface can be used to start build processes for individual or all data feeds, query the status of a running build, and prepare time- or import-controlled builds.

The build processes ensure that current and complete export files are generated on the basis of the existing templates and data.

### GET datafeeds/build/\{id}/status

This method returns the current status of the build process of a data feed. It enables you to monitor whether a data feed is currently being created, has already been completed, or whether errors occurred during creation.

Each element of the response contains `filePath` (relative file path) and `status` (status information). Additionally, the `url` field is returned if the data feed's `saveTarget` is `"contentData"`.

Read permissions for data feeds are required for access.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/build/2/status
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
[
    {
        "filePath": "/abc/deutsch_myFeed.csv.zip",
        "status": {
            "createdAt": "2025-04-30 14:28:59",
            "datafeedId": 5,
            "exportStatus": "finished",
            "id": 1,
            "lastExportError": "",
            "lastExportFinished": "2025-04-30 14:29:00",
            "lastExportStarted": "2025-04-30 14:28:59",
            "subshopId": "deutsch",
            "updatedAt": "2025-04-30 14:29:00"
        }
    },
    {
        "filePath": "/abc/english_myFeed.csv.zip",
        "status": {
            "createdAt": "2025-04-30 14:28:59",
            "datafeedId": 5,
            "exportStatus": "finished",
            "id": 2,
            "lastExportError": "",
            "lastExportFinished": "2025-04-30 14:28:59",
            "lastExportStarted": "2025-04-30 14:28:59",
            "subshopId": "english",
            "updatedAt": "2025-04-30 14:28:59"
        }
    }
]
```

#### Error codes

| **Error**        | **Type**       | **Reason**                                                   |
| ---------------- | -------------- | ------------------------------------------------------------ |
| 401 Unauthorized |                | Not authorized: you are not logged in.                       |
| 403 Forbidden    |                | You do not have the required permissions to read data feeds. |
| 400 Bad Request  | "invalidValue" | `id` is invalid.                                             |
| 404 Not Found    |                | Data feed with `id`=`{id}` was not found.                    |
| 400 Bad Request  |                | The corresponding template could not be found.               |

### POST datafeeds/build/all

This method starts the build process for all data feeds present in the system. All defined data feeds are recreated. Execution is asynchronous; the endpoint only confirms the start of the process.

Publish permissions for data feeds are required.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/build/all
```

#### Request body

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{"success": true}
```

#### Error codes

| **Error**               | **Type**             | **Reason**                                                      |
| ----------------------- | -------------------- | --------------------------------------------------------------- |
| 401 Unauthorized        |                      | Not authorized: you are not logged in.                          |
| 403 Forbidden           |                      | You do not have the required permissions to publish data feeds. |
| 503 Service Unavailable | "serviceUnavailable" | `FeedBuilderUrl` does not exist, or generation failed.          |

### POST datafeeds/build/\{id}

This method starts the build process for a specific data feed by its unique ID. The selected feed is recreated. Execution is asynchronous; the endpoint only confirms the start of the build process.

With the optional query parameter `subshopId` (can be specified multiple times), the build can be restricted to specific subshops.

Publish permissions for data feeds are required.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/build/2
```

#### Request body

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{"success": true}
```

#### Error codes

| **Error**               | **Type**             | **Reason**                                                      |
| ----------------------- | -------------------- | --------------------------------------------------------------- |
| 401 Unauthorized        |                      | Not authorized: you are not logged in.                          |
| 403 Forbidden           |                      | You do not have the required permissions to publish data feeds. |
| 400 Bad Request         | "invalidValue"       | `id` is invalid.                                                |
| 404 Not Found           |                      | Data feed with `id`=`{id}` was not found.                       |
| 503 Service Unavailable | "serviceUnavailable" | `FeedBuilderUrl` does not exist, or generation failed.          |

### POST datafeeds/build/hour/\{hour}

This method starts the generation of data feeds that must be generated at a specific hour. The path parameter `{hour}` specifies the hour in 24-hour format (`0` to `23`). Generation is asynchronous — this means the response does not return a finished file but only confirms the start of the process.

Publish permissions for data feeds are required.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/build/hour/12
```

#### Request body

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{"success": true}
```

#### Error codes

| **Error**               | **Type**             | **Reason**                                                      |
| ----------------------- | -------------------- | --------------------------------------------------------------- |
| 401 Unauthorized        |                      | Not authorized: you are not logged in.                          |
| 403 Forbidden           |                      | You do not have the required permissions to publish data feeds. |
| 404 Not Found           |                      | The `hour` parameter is missing or invalid.                     |
| 503 Service Unavailable | "serviceUnavailable" | `FeedBuilderUrl` does not exist, or generation failed.          |

### POST datafeeds/build/import

This method starts the build process for all data feeds that should be generated automatically after an import process. Feed creation is asynchronous.

Publish permissions for data feeds are required.

#### Example

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
http://www.<your-shop>.de/admin/api/v1/datafeeds/build/import
```

#### Request body

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{}
```

#### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{"success": true}
```

#### Error codes

| **Error**               | **Type**             | **Reason**                                                      |
| ----------------------- | -------------------- | --------------------------------------------------------------- |
| 401 Unauthorized        |                      | Not authorized: you are not logged in.                          |
| 403 Forbidden           |                      | You do not have the required permissions to publish data feeds. |
| 503 Service Unavailable | "serviceUnavailable" | `FeedBuilderUrl` does not exist, or generation failed.          |

## Support

Bei technischen Fragen und Hilfestellungen ist unser Support-Team für Sie erreichbar: [Zum Kundenportal](https://websale.atlassian.net/servicedesk/customer/portal/6)

Bitte senden Sie uns eine möglichst detaillierte Beschreibung sowie Screenshots, Requests/Antworten, damit wir Ihre Anfrage zeitnah und zielführend beantworten können.
