Create a data feed
const url = 'https://api.tryletterhead.com/api/v3/curations/data-feeds?api=true';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"title":"Vendor product catalog","description":"Nightly product export from our commerce platform.","feedUrl":"https://example.com/api/products.json","archiveIntervalDays":1,"authType":0,"fieldMappings":[{"source":"object.name","target":"title"},{"source":"object.description","target":"excerpt"},{"source":"object.url","target":"url"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'https://api.tryletterhead.com/api/v3/curations/data-feeds?api=true' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "title": "Vendor product catalog", "description": "Nightly product export from our commerce platform.", "feedUrl": "https://example.com/api/products.json", "archiveIntervalDays": 1, "authType": 0, "fieldMappings": [ { "source": "object.name", "target": "title" }, { "source": "object.description", "target": "excerpt" }, { "source": "object.url", "target": "url" } ] }'Create a company-level JSON data feed: a JSON endpoint plus a set of field mappings that turn each item it returns into a curation. Letterhead fetches it immediately after creation.
Every entry in fieldMappings needs a source (a dot path into a feed itemโs JSON, e.g.
object.id) and a target โ either a standard curation field (title, excerpt, content,
url, image, imageAlt, imageCaption, author, siteName, publicationDate) or a custom
field reference in the form customField:<key> (see List curation custom fields). url,
title, and excerpt must all be mapped.
Authorizations
Section titled โAuthorizations โParameters
Section titled โ Parameters โQuery Parameters
Section titled โQuery Parameters โRequired. Set to true to authenticate with your company API key rather than a signed-in session.
Request Body required
Section titled โRequest Body required โobject
How often, in days, to re-fetch the feed (1โ31).
Internal numeric channel identifiers to share this feed with.
object
0 โ no authentication. 1 โ bearer token, supplied via bearerToken.
Plaintext on the way in, stored encrypted. Required when authType is 1.
Example
{ "title": "Vendor product catalog", "description": "Nightly product export from our commerce platform.", "feedUrl": "https://example.com/api/products.json", "archiveIntervalDays": 1, "authType": 0, "fieldMappings": [ { "source": "object.name", "target": "title" }, { "source": "object.description", "target": "excerpt" }, { "source": "object.url", "target": "url" } ]}Responses
Section titled โ Responses โData feed created
object
The shape returned for both RSS feeds (List curation feeds) and JSON data feeds (List data
feeds) โ type (0 RSS, 1 JSON data feed) tells the two apart. fieldMappings, authType,
and hasAuthSecret are only meaningful on a JSON data feed.
object
0 RSS feed, 1 JSON data feed.
The channel this feed was originally created against, or blank for a feed shared to multiple channels with no single owner.
Internal numeric identifiers of every channel this feed is shared with.
0 โ no authentication. 1 โ bearer token.
Whether a credential is stored โ the credential itself is never returned.
object
Example generated
{ "items": { "uniqueId": "example", "title": "example", "description": "example", "feedUrl": "example", "type": 1, "isValid": true, "validationCode": 1, "crawl": true, "archiveIntervalDays": 1, "lastValidated": "example", "lastQueried": "example", "channelName": "example", "channelSlug": "example", "sharedChannelIds": [ 1 ], "tags": [ "example" ], "authType": 1, "hasAuthSecret": true, "fieldMappings": [ { "source": "example", "target": "example" } ], "createdAt": "example", "updatedAt": "example", "deletedAt": "example" }, "message": "example", "total": 1}Still can’t find what you need? Contact support.