結果 : how to write an api call in javascript