'q': 'food',
'section': 'news', //news, lifestyle, sports, Opinion Comment is free Columnists Letters Obituaries Inequality Long reads \\
// 'tag': 'healthcare',
'page-size' : 20,
'show-fields': 'all'
})
// console.log(apiUrl)
fetch(apiUrl).then(response => response.json())
.then(data => {
console.log(data)
let container = document.querySelector('.card-container')
let results = data.response.results;
results.forEach(result =>{
let title = document.createElement('h2')
title.innerHTML = result.fields.headline;
let trailText = document.createElement('p')
trailText.innerHTML = result.fields.trailText
let weburl = document.createElement('a')
weburl.setAttribute('href', result.webUrl)
weburl.innerHTML = result.webUrl
let card = document.createElement('div')
card.classList.add('card')
let img = document.createElement('img');
img.setAttribute('src', result.fields.thumbnail)
img.innerHTML = result.fields.thumbnail;
container.appendChild(card);
card.appendChild(img)
card.appendChild(title)
card.appendChild(trailText)
card.appendChild(weburl)
})
})
this seems to be working now. But i dont understand how to use the sections and tags, what are all the possible inputs for those and how would i go about including all possible inputs for section and tags?