How to perform an analytics api call across all environments in my org?

The documentation page at: http://apigee.com/docs/analytics-services/content/use-analytics-api-measure-api-program-performance mentions: To get statistics for APIs (or any other dimension) across all environments, a wildcard URI pattern is supported:

https://api.enterprise.apigee.com/v1/o/{org_name}/environments/*/stats/apis

However, when I tried this out I encountered the following error.

{   "code": "Please specify exact environment - * in context of environment is not supported. ",   "message": "Please specify exact environment - * in context of environment is not supported. ",   "contexts": [] }

The endpoint that I used was: https://api.enterprise.apigee.com/v1/o/{myorg}/environments/*/stats/apis?select=sum(message_count)&t...

Any thoughts?

Solved Solved
2 5 303
1 ACCEPTED SOLUTION

Hi @Cladius Fernando - I think this is a documentation issue. AFAIK Analytics API always expect an environment as part of the URL. If you want to get analytics across environments, you will have to write a simple script to fetch all environments and then loop through each one of them individually. However I agree that an API across environments would really help.

View solution in original post

5 REPLIES 5

Not applicable

We can get the analytics provisioning status by comma separated list of environments. Similar approach is not working for stats api

https://api.enterprise.apigee.com/v1/o/{org_name}/environments/test,prod/provisioning/axstatus

Hi @Cladius Fernando - I think this is a documentation issue. AFAIK Analytics API always expect an environment as part of the URL. If you want to get analytics across environments, you will have to write a simple script to fetch all environments and then loop through each one of them individually. However I agree that an API across environments would really help.

@Cladius Fernando

, sorry for the confusion! That was a doc bug. We've removed that content.

Hi @sudheendra1, thanks for confirming my suspicions. Yes, that's what I had already done for now (i.e. making a separate call for each environment and adding up the numbers) to work around the limitation. Could you please log an enhancement request for the consolidated-stats api?

Thanks @Floyd Jones, for correcting the documentation. There is another section that needs to be corrected in the same article which says:

The following dimensions are supported: /apis, /apiproducts, /apps, /devs, /envs

The dimension "envs" is not supported (the remaining 4 are working properly). [Actually since the endpoint already requires the environment name in the url, this dimension would not be applicable here.]

Yes, I have already posted the enhancement request. Thanks!