Apigee Analytics: How to Automate CSV File Download?

Is there anyway to Automate the download of CSV files for the Apigee Analytics Report? For example every 12 midnight, it should generate a csv file and store it somewhere. This is the idea but the details are not yet constructed. I just want to know if anything like this is possible on Apigee.

Thanks in advance for your help!

1 Like

@Junnes Ashley Pineda

You can do that using Analytics API, You can call the API, get the response, construct CSV & store where ever you want.

What do you mean by construct the csv? what I am trying to do is that the generated csv should automatically download based on the specified time of the day/ week.

Another thing, aren’t the analytics api can only get apigee provided dimensions? how about the custom dimensions?

@Junnes Ashley Pineda

Check my answer here and let me know if that helps

https://community.apigee.com/questions/41431/access-custom-reports-data-via-analytics-api.html?childToView=41436#answer-41436

Once you know what APIs you need to call, you can write a script to generate CSV( node.js for example)

@Maruti Chand Can this process be run on batch? or in an automated manner? wherein I will just call the Analytics API and the node.js will convert it to a csv file based on the specified time? I am not quite familiar with node.js though.

@Junnes Ashley Pineda , Yes, Using node.js you can run it like a batch of reports or frequently run same using cron. See node.js module which converts json to csv here.

  • Make an API call to Analytics report in Node.JS using report id
  • Extract the report metrics & dimensions
  • Make an API to call to Apigee Analytics
  • Json response will have all the data, Convert to CSV using above node module.

Hope it helps.

1 Like

@Junnes Ashley Pineda That was an example, it doesn’t need to be node.js.

basically, you need to parse the json and get whatever you want in a CSV.

You can either run all APIs at one shot or sequentially.

1 Like

@Anil Sagar @Maruti Chand I am having errors in trying to access the analytics API. I have my code below and when I try to add it in a service callout policy like in the code below, It says that my code is an Invalid XML:

http://hostname/v1/organizations/ntp/environments/prod/stats/developers?select=sum(message_count)&timeRange=05/21/2017%2000:00~05/26/2017%2000:00&timeUnit=day

I hid the value for the hostname I am using. And when I use soap/ Postman, I am getting Data Access Error.

Can you please help? thanks!