Refactor restapi URL bits