set up api urls factory to avoid hard coding url in more than one place