Need to generate Flat files

I have been using the API to drive data into our dashboarding tool that does a mashup. I need the API string to pull the following in flat format:

1st:
Site ID, Page Titles, Visits to page title

2nd:
Site ID, Locations, Visits from Location

I have about 20 sites running on piwik.

Thanks in advance…