Slightly modified url creation function for api