Is there any Apigee Management api which can give the number of times an api proxy is invoked.
There is an apigee management api to get the message count at organization level but i need to know at api level.
Solved! Go to Solution.
Hey @Ankit Goel You may use Analytics API for this feature.
Here is what a sample API call looks like to analytics API. This will give data between date range of a month.
curl -v "https://api.enterprise.apigee.com/v1/organizations/{org}/environments/{environment}/stats/?select=sum(message_count)&timeRange=03/01/2016%2000:00~03/31/2016%2024:00" -u email
Here you can try it quickly using this link below.
https://apidocs.apigee.com/management/apis/get/organizations/%7Borg_name%7D/stats
Hope that helps.
Hey @Ankit Goel You may use Analytics API for this feature.
Here is what a sample API call looks like to analytics API. This will give data between date range of a month.
curl -v "https://api.enterprise.apigee.com/v1/organizations/{org}/environments/{environment}/stats/?select=sum(message_count)&timeRange=03/01/2016%2000:00~03/31/2016%2024:00" -u email
Here you can try it quickly using this link below.
https://apidocs.apigee.com/management/apis/get/organizations/%7Borg_name%7D/stats
Hope that helps.
Thanks for the reply @Jyothi K Reddy. But this thing i already know, and it gives the count of api calls with in the whole organization and environment but i need to know the count of any particular api being called within an organization/environment but not the sum of all the api calls in that org.
Hi @Ankit Goel . Yes you can extend this same API call as follows.
curl -X GET --header "Authorization: Basic XXXXX " "https://api.enterprise.apigee.com/v1/organizations/{org_name}/environments/{env_name}/stats/apiproxy?select=sum(message_count)&timeRange=10%2F08%2F2018%2000%3A00~10%2F15%2F2018%2023%3A59"
Please note that in the url, after '/stats' , I added apiproxy. This will give response like below. Where "name" is the name of your API proxy.
{ "environments": [ { "dimensions": [ { "metrics": [ { "name": "sum(message_count)", "values": [ "2.0" ] } ], "name": "xxxxx" }, { "metrics": [ { "name": "sum(message_count)", "values": [ "1664.0" ] } ], "name": "yyyy" }, { "metrics": [ { "name": "sum(message_count)", "values": [ "253.0" ] } ], "name": "zzzzzz" }, { "metrics": [ { "name": "sum(message_count)", "values": [ "5310.0" ] } ], "name": "aaaa" } ], "name": "test" } ], "metaData": { "errors": [], "notices": [ "Source:Postgres", "PG Host:hostname.hostname.com", "Table used: edge.api.faxgroupusenondn012.agg_api", "query served by:431b6765-b4a6-41cc-9fec-76617962e13a" ] } } <br>
Also, Dino wrote this node JS tool as well if you'd like to go that route.
https://github.com/DinoChiesa/ApigeeEdge-API-Traffic-Summarizer
Hope that helps.
Hi @Jyothi K Reddy, i tried this but i am getting below mentioned error.
[root@apigee logs]# curl -X GET -u ankit@xyz.com:Password@12 "http://192.168.127.35:8080/v1/organizations/xyz/environments/test/stats/apiproxy_name/?select=sum(message_count)&timeRange=10/17/2018%2000:00~10/22/2018%2020:00" { "code" : "analytics.dataapi.service.data_access_error", "message" : "Data Access Error - Data Access Error", "contexts" : [ ] }[root@apigee logs]# [root@apigee logs]# [root@apigee logs]# <br>
Can you please suggest what can be the cause of this error.
Hi @Ankit Goel Could you try /stats/apiproxy/?select......
instead of test/stats/apiproxy_name/?select...
Thanks
Hi @Jyothi K Reddy, apiproxy_name is just a name i added, it can be the name of any api proxy being monitored.
I added apis followed by the apiproxy name after stats and it worked 🙂
curl -X GET -u ankit@xyz.com:Password@12 "http://192.168.127.35:8080/v1/organizations/xyz/environments/test/stats/apis/apigee-tickstack/?select=sum(message_count)&timeRange=10/17/2018%2000:00~10/22/2018%2020:00"
Thanks a lot 🙂
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |