Taffrail rules list
by taffrail
HTML
<h3>
Rules
</h3>
<ul id="list">
</ul>
JavaScript
// optionally - add `fields[rules]` sparse fieldset querystring
// if you're only using the `links`, just use `fields[rules]=links`
fetch("https://engine.taffrail.com/api/rules?keyword=ira+traditional+roth+sep&fields[rules]=adviceset,links,opengraph,sources", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer TFfos5FOyMtIBdFiN1u91Ml.wJqr-v3ywxaJv6zMI746R1i0fkS79jM3IUPWLcXtZc"
},
}).then(api => {
return api.json();
}).then(api => {
//console.log(api.data);
const listEl = document.getElementById("list");
api.data.rules.forEach(rule => {
const li = document.createElement('li');
const a = document.createElement('a');
a.href = rule.links.share;
a.textContent = rule.opengraph.title;
a.target = '_blank'; // Open in new tab
li.appendChild(a);
listEl.appendChild(li);
});
});