construct api url using window.location