Hi, I was able to resolve the error.
Make sure to handle the null values before calling the API. Since, the API would be called every time you enter a search query, I realized that the bad request error came in the beginning, when there was no search input and, after the search field was cleared (after backspace) to enter a new input.
That is, the empty search field also revoked the API by sending query="".
A simple if else statement worked for me!
if (query != '' || null) {
result = this.http
.post<any>(
ServerDetails.searchUriS,
JSON.stringify({
search: `${query}`,
top: 5, // Change to a number
fuzzy: true,
....
}),
options )
Thanks for your support, I'll close the issue.