add location API and test code