Feeds

Just like product in Ecommerce must be published using a product catalogue app, products in a channel must be published using a feed. A feed is a web page which contains data in a specific format – e.g. JSON – that complies with the requirements of an external service.

The data is typically not formatted to be human readable (Figure 1.1), but you can use a JSON formatter to prettify the output and verify that you have added the right data.

Figure 1.1 A product feed

Feeds are simple constructions which consist of:

  • A query which retrieves product data from an index
  • A context section which defines the languages &  currencies which should be included in the feed
  • A format section which defined the data which should be published and the format it should be published in

Feed data is published in on a page by default, but it can also be saved to a file.

First, you must construct an index query to retrieve the correct product data:

  • Go to Settings > Repositories and open a product index
  • Create a new query which returns the products you want to publish

So what do you want to publish? Typically, you want to publish only the products which have been added to a particular channel - e.g. Amazon DK - and so you should add an expression which checks that the SHOP IDs field contains the channel name, e.g. Amazon DK.

You can also pass values from the feed to various parameters, e.g. a Language parameter - in this way you won't have to create different queries & feeds for e.g. Amazon UK and Amazon DK feeds.

To create a feed go to the PIM area, open a context-menu, and click New feed – then configure the feed:

  • Provide a name
  • Select the index query
  • (Optional) override the Language parameter and set the default value to the language ID you want to publish (e.g. LANG1)
  • In the context section, select the languages & currencies you want to publish data for
  • In the format section select an appropriate feed provider and configure it.

Currently, the following providers are available:

Provider

Used for

Comments

Template feed provider

Generating custom feeds using a ViewModel template

To use: 

  1. Select or create a template for generating the feed
  2. Specify a content type
  3. Select the data you want to include in the feed
  4. Save

An URL to the feed will be generated, and can be visited/used externally.

XML feed provider Generating XML feed data - and (optionally) transforming this data using an XSLT stylesheet.

To use:

  1. Select the data you want to include in the feed
  2. Select an XSLT stylesheet which transforms the XML to your desired format
  3. Save

Like many other parts of the system, Feeds can be organized on folders

When you save a feed, one or more API URLs to the feed will be generated (Figure 4.1) - click these to review the current feed output in a new tab. Each URL is listed with their selected options, which the feed is based on.

Figure 4.1 Feed API URLs

The API URLs can be extended with custom parameters, provided that the repository query is set up to receive them. Simply add the parameter to the querystring and pass values to it:

http://yoursite.dk/dwapi/Feeds/GetFeedOutput?Id=2&languageId=LANG6¤cyId=DKK&MyParameter=Foo

Feed data may be automatically saved to a file by creating a scheduled task using specific add-in called the Feed File Export Task:

  1. Go to Settings > System > Scheduled tasks and click Add in the toolbar
  2. Name the task
  3. Switch the activation selector to Add-in
  4. Select the Feed File Export Task add-in and configure it (Figure 5.1)
Figure 5.1 Configuring the Feed File Export Task

You must:

  • Select a feed
  • Specify a file name and a destination
  • Select the language and currency you want to export

Once the task is run – either manually or on a schedule – the file is created and can be interacted with, e.g. moved to an FTP server for upload to an external system.