improved
New API response format
almost 2 years ago by Mark Healey
Versions 0.16.0 (beta) and 0.17.0 represent the introduction of a new API response format for the Taffrail API.
This is entirely opt-in right now. Some details are below.
Advice API JSON
In V1 (anything prior to 0.16.0), the API responds with a single advice[]
array containing the stack of "display nodes" in the order our Engine sees them.
In V2, the API relies on this same "display node" collection, but the API returns new subsets of the data instead of a singular advice[]
array that needs to be filtered client-side.
Replaced advice[]
with:
advice[]
with:advice[]
- collection of "regular" advice (basically any Advice node without atype
tag specified)assumptions[]
- collection of Advice nodes tagged asassumption
typecurrentFocus{input request}
- current location where API is stuck, i.e., the last unanswered question. If all questions are answered, this field disappears.examples[]
- collection of Advice nodes tagged asexample
typeinputRequests[]
- collection of Input Request nodes- Each item now has two additional properties:
index (int)
- literally the index of the item in the arraybacklink{}
- the id, name, and value of the variable linked to the input request. This is currently looked up every time client-side.
- Each item now has two additional properties:
opengraph{}
- object containing open graph data for link previews, search engines, etc. The data is sourced from the first Advice node (the primary recommendation/main heading)sources[]
- combined list of all AdviceSet and Input Request and Advice reference documents, de-duplicated
Overhauled Sources (referenceDocuments[]
)
referenceDocuments[]
)- Added
fileId
property to all types - For any non-
link
or non-file
types, no changes - For
file
s:- Removed
body
if NULL - Add
sizeFormatted
using the Numeral library - Add
displayUrl
, e.g.,View file (pdf), 1.2mb
which helps with consistency when building lists of links when some are files
- Removed
- For
link
s:- Removed
size
- Removed
versionId
- Changed
contentType
fromtext/plain
totext/x-uri
- Added
url_isCanonical
if the OG scraper found one - Added
displayUrl
which is the URL without the protocol and host prefix
- Removed
Removed
- Remove
audienceType
(root level), it is no longer in use
HTML rendering
- Any Markdown table elements will automatically have
class="taffrail-table"
added to the markup - Any Markdown blockquote elements will have
class="taffrail-blockquote"
added to the markup