Company search / company name syntax

I’m new to both google apps script and the CH API. I want to query the api using a company name, so far i have the following code which is from this post https://forum.aws.chdev.org/t/authentication-issue-using-google-app-script/2813/5 :

function findCHInfo() {

//this works for a number

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("Sheet1")
  var optionsheet = ss.getSheetByName('Options');
  var sheet = ss.getSheetByName("Sheet1");

var my_api_key = optionsheet.getRange('C2').getValue();

// Logger.log(my_api_key);

var headers = {

"Authorization": "Basic " + Utilities.base64Encode(my_api_key+":"),

}

var params = {
"method":"GET",
"q":"Barclays Bank",
//items_per_page
"headers":headers,
muteHttpExceptions: true,
};

//var url = "https://api.companieshouse.gov.uk/company/00000006";
var url = "https://api.companieshouse.gov.uk/search/companies"

var response = JSON.parse(UrlFetchApp.fetch(url, params).getContentText());
Logger.log(params, response);

}

please could you advise on how to modify this code so i get a meaningful response? If i search using a number (as in the original code), then all the correct data comes back in the response, using a text string i get the following in the reponse:

[20-07-30 12:08:30:717 BST] {method=GET, q=Barclays Bank, muteHttpExceptions=true, headers={Authorization=Basic M0EydjNmZnpxc2JXSWJBa0dtR2FpcUdIdmEyYjVja3hGb19KTFJpRTo=}} {items=, total_results=0.0, items_per_page=20.0, kind=search#companies, start_index=0.0, page_number=1.0}

Many thanks for any guidance!

ok, so forgive my ignorance, using the following:

var url = "https://api.companieshouse.gov.uk/search/companies?q=barclays+bank"

i get a correct response…

so, do i first use replace() to remove spaces and replace with a + on my list of company strings or is there something else i’m missing?