I was creating a ConfigurationVO object and I was setting the $apiVersion parameter to v2. When I then used the MastodonAPI object that I can created using the ConfigurationVO object, when I called (in my case) the /search endpoint, I got a 404 error from the API, because it was trying to call /api/v1/search. It did not respect the v2 I had set because the code was using the ConfigurationVO::API_VERSION constant, which is set to v1.
The solution
Instead of using the constant from the ConfigurationVO class, I use the $apiVersion property of the $this->config instead of the VO. Now, when I call the getPublicData('/search'), it respects the version and calls the v2 API.
What happened?
I was creating a ConfigurationVO object and I was setting the
$apiVersion
parameter tov2
. When I then used theMastodonAPI
object that I can created using the ConfigurationVO object, when I called (in my case) the/search
endpoint, I got a 404 error from the API, because it was trying to call/api/v1/search
. It did not respect thev2
I had set because the code was using theConfigurationVO::API_VERSION
constant, which is set tov1
.The solution
Instead of using the constant from the ConfigurationVO class, I use the
$apiVersion
property of the$this->config
instead of the VO. Now, when I call thegetPublicData('/search')
, it respects the version and calls thev2
API.