make trailing slash optional for api calls #662