format results and switch api call