I have tried to get latest api version through /service/data . I have refered this link also Find current API version in Apex
But when i used latest version in this :
final PageReference theUrl = new PageReference(SERVER_URL + '/services/data/+version+/query');
theUrl.getParameters().put('q','Select Name From ApexClass');
Its throwing 404 error response. Any help would be appreciated.
c.
or a{namespace}.
in URL depending if org has a namespace. Try hardcoding the URL to check if its issue with URL:?