How to use Jmespath to map to customFields ANS values in Outbound Feeds
If you use a customField to map an ANS field when populating a feed, you must use the Jmespath syntax. This document presents examples of the most common use cases with the Jmespath patterns you must use when mapping ANS fields.
Mapping to a single field
This example maps the ANS headline to the title of an article. This is the default value that is used in the Title customField:
headlines.basic
Mapping to multiple fields
Suppose your organization creates shorter mobile friendly headlines for stories with very long headlines using headlines.mobile
. But headlines.mobile
is only populated when the headline is too long. You can use headlines.mobile
and fall back to headlines.basic
if itβs not filled out, as in the following example:
headlines.mobile || headlines.basic
Mapping to a field in an object
If you want to get all the authors names from a story, the credits.by
field contains an array of author objects. You can get a list of the authors names using the following. Notice that the position of arrays must be included:
credits.by[].name
If you only want the first authors name you can specify the index position. You must add brackets around the name so it still returns the results as a list.
credits.by[0].[name]
This example includes multiple fields to return the authors byline first and fall back to name:
credits.by[].additional_properties[].original.byline || credits.by[].name