REST API and convert json response to CSV data