The guardian api

Hi i am trying out the guardian api i have managed to retrieve some data but how do i dynamically change the query parameter? how do i manipulate the url
fetch(‘https://content.guardianapis.com/search?q=middle%20easr&api-key=1b5becf1-37******-*******’).then(response => response.json())
.then(data => {
let container = document.querySelector(‘.card-container’)
let results = data.response.results;
results.forEach(result =>{
let title = document.createElement(‘p’)
title.innerHTML = result.webTitle;

    let weburl = document.createElement('a')
    weburl.setAttribute('href', result.webUrl)
    weburl.innerHTML = result.webUrl


    let card = document.createElement('div')
    card.classList.add('card')

    container.appendChild(card);
    card.appendChild(title)
    card.appendChild(weburl)
    console.log(result.webUrl)

})

})
so in my url i have the base url + middle east as my query and then my api wich i have starred out, how do i add these in dynamically ? not sure if my question is clear

i tried this but does not work
let params = new URLSearchParams({
‘q’: ‘middle east’,
‘section’: ‘technology’,
‘page-size’ : 5,
‘orderBy’: ‘newest’,
‘api-key’: apiKey,
})

const apiUrl = https://content.guardianapis.com/search/${params};

console.log(apiUrl)
says no api found
so i tried this bbut it just so messy and im not sure how to play around with all the parameters

const baseUrl = ’ https://content.guardianapis.com/search’;

let pageSize = 8;
let pageUrlparam = &page-size=${pageSize}

let parameter = ‘burger’

let encodedParam = encodeURIComponent(parameter)
let queryParams = ?q=${encodedParam}&api-key=${apiKey}

let url = ${baseUrl}${queryParams}${pageUrlparam}
console.log(url)
how can i improve on this ? im just relatively new to learning js but not happy with what i have so far

const apiKey = ‘**********************’
let params = new URLSearchParams({
‘q’: ‘gaza’,
‘section’: ‘technology’,
‘page-size’ : 20,
‘orderBy’: ‘newest’,
‘api-key’: apiKey,
‘show-fields’: ‘thumbnail’
})

const apiUrl = https://content.guardianapis.com/search?${params};

figured it out, after 24 hours almost pffft!