I have an api that I can test at it's current endpoint with a query (this is for a search with autocomplete) like so:
.../search/autocomplete?query=product123
And this returns the results expected. However, this is the first time I've made a php rest/wrapper for an api using a query instead of fields.
My question is, using a hard coded test variable below, How should I properly pass this into the function and properly query the endpoint?
This is a test but basically it's going to be used as someone types into a search box and passes from there, so same idea.
Am I on the right track with this?
$testVariable = "product123"
public function getSearch($testVariable)
{
return $this->get("/search/autocomplete?query={$testVariable}");
}