Content Sources

Located at DrEdition: "Settings" -> "Content Sources" -> "Add" or choose an existing Content Source.

A content source is used to give DrEdition access to the content of your CMS/article database. DrEdition expects the content source to return JSON data, but it has few requirements to how your data is structured, which is handled by the mapper function.

Endpoint authentication

Aptoma products are running in the cloud (SaaS), and thus all auxiliary systems that need to integrate to Aptoma services needs to be available on the internet (i.e. not only behind a specific firewall).

DrEdition allows you to set custom headers in the request sent to your system when authentication is needed to protect sensitive data.

IP whitelisting our services is not an option, as our services does not have, and cannot have, static IP addresses.

The JSON should as a minimum contain the article id, title and also preferrably the main image thumbnail and category for each article in the list. The endpoint should preferably have text search and filter capabilities to let editors search for content more easily.

Content Sources have a URI template, optional default parameters, one or more content queries and a Response Function.

Content Sources and Content Queries, including a Response Function (which are all described below) are the only required setup to get started with DrEdition. It is quite comprehensively designed to make maintenance scalable, so all below steps are needed.

Import lists (far left on Illustration 1 below) are based on Content Queries made on Content Sources. A Content Source will typically be your article database. If you're using DrPublish from Aptoma, DrPublish will be your (or one of your) article database(s).

Illustration 1: DrEdition overview.

Defining a Content Source

A Content Source requires a URI Template, which can look like this if you're using DrPublish.

Each parameter can receive a default setting, or be defined as {INPUT}. Defining a parameter as {INPUT} automatically adds an advanced search option in DrEdition where editorial staff can enter values.

Default Parameters
Use {INPUT} for parameter 'id' to expose a search box for 'id'.

Define Content Queries on the Content Source

Located at DrEdition: "Settings" -> "Content Sources" -> Choose a content source. -> "Add" on Content Query section.

Content Queries are refined queries against a Content Source. It could i.e. be "the 50 latest published articles", or only from a specific category, tag, etc. You can have multiple Content Queries towards a single Content Source.

When a Content Source has been defined, and default parameters has been defined, you will need to define a Content Query before it is ready for use by editorial staff. Content Queries can conveniently piggy-back on defaults, or override with specific settings.

Illustration: Adding Content Queries on a Content Source

The final step: Enabling a Content Query for a Product

Located at DrEdition: "Products" -> Press "Edit" on a Product.

Content Queries are now ready to run, but you'll have to decide on a per-product basis whether to expose any specific Content to editorial staff using this product. Head over to "Products" in the menu and click "Edit" on the product in question. While editing this product, you can add any Content Query editorial staff will need on this product.

Add Content Queries to a Product.

Response Functions: Normalising data from Content Queries

Located at DrEdition: "Settings" -> "Content Sources" -> Choose a content source.

DrEdition assumes all Content Queries based on the same Content Source returns data of the same format, and DrEdition also requires a Content Source to return data in a JSON syntax.

You do not need to worry about data format of the Content Source, though, as DrEdition allows you to define mapper functions to normalise data for use in a DrEdition context.

Response Functions are thus defined on the Content Source (Settings -> Content Sources). To give you a sense of how a mapper function can be setup, here's a partial example.

Please note that id and type are required for DrEdition GUI to create a list from the data.

'use strict';
return response.body.items.map((item) => {
const section = item.meta.categories.find((cat) => cat.isMain === '1').name;
const mainTag = item.meta.tags.find((tag) => tag.position === 1);
const splitTitle = item.meta.headline.split(':', 2);
return {
id: item.meta.id,
pretitle: splitTitle.length === 2 ? splitTitle.shift() + ':' : '',
title: splitTitle.shift(),
type: 'sphynx-article',
priority: item.meta.articleTypeMeta.priority || 'B',
features : { premium : item.meta.articleTypeMeta.premium || false },
tag: mainTag && mainTag.name || '',
image: getMainImage(item),
url: `/${section.toLowerCase()}/${item.meta.id}`
};
});

The mapping must adhere to Content Schemas that you are using for your Product Type in question.