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 – this typically means:
    • You create a Language parameter
    • You create an expression which checks that the SHOP IDs field contains the channel name (here Amazon)
    • You create an expression which checks that the Language ID field equals the Language parameter value

The idea with the Language parameter is that you can use the same query for multiple feeds – and simply set the parameter value on each feed. This means you won’t have to create different queries for e.g. Amazon UK, Amazon DK, or Amazon DE 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

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

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

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) - open these to review the current feed output.

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&currencyId=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.