Implement an API query and transform this  data into a csv file