To retrieve the users which are not consuming the api from apigee edge

Our system has a large number of users who previously accessed one of our APIs. However, some of these users haven't interacted with the API in several months. We'd like to identify these inactive users and send them a notification reminding them of their access. The notification will inform them that their access may be revoked if they don't take any action to maintain it.
Is there a specific API call or example script available within our system that allows us to retrieve a list of users based on their inactivity (i.e., users who haven't made any API calls for a certain period)?

1 4 97
4 REPLIES 4

Hello @Ragava1 ,

You have to perform 3 steps to achieve this,

Step 1: Call the management API to list out developer emails, And keep it in excel column "List A"

 

curl -X GET 'http://MS:8080/v1/organizations/{org}/developers' \
-H 'Authorization: Basic '

 

 Step 2: Call the below stats API to get list of developers who is having traffic in the month of Feb-2024. In postman create a test script for this API request to convert response dimensions to string list & log it in console

 

curl -X GET 'http://MS:8080/v1/organizations/org-name/environments/env-name/stats/developer_email?limit=14400&select=sum(message_count)&sort=ASC&sortby=sum(message_count)&timeRange=02%2F01%2F2024+00:00:00~02%2F29%2F2024+23:59:59&timeUnit=month' \
-H 'Authorization: Basic '

 

Postman test script

 

let responses = pm.response.text();
let dimArray = [];
let devNames = "";
if(responses) {
  responses = JSON.parse(responses);
  let resObj = responses;
  if(resObj.environments){
    dimArray = resObj.environments[0].dimensions;
  }
}
for(let i = 0; i < dimArray.length; i++) {
    devNames+=dimArray[i].name+"\n";
}
console.log(devNames);

 

For the above mentioned you'll receive response in postman console

chrismca73_0-1710823714708.png

Copy this to same excel to the "List B" column.

Step 3: Now you're having List A(All Developers email) and List B(Developers with traffic count), do excel comparison and find out the missing developers(Developers without traffic), link for help

Hi Chris, 

Thank you for the answer I really appreciate it, but we have more users, and from experience, we can able to pull maximum 1000 developers in call and I need to repeat several times and same for second call as well. 
for the certain extent your solution works. 
Thank you. 

Hi @Ragava1 ,

Hope you're doing well.

You can use the query parameter count in the first API call to extend the limit I guess. I tried it by myself, where I can limit it to 100 or 500 where my developer set is limited, so extending it to 1100 or more might work, take a try once.

 

curl -X GET 'http://MS:8080/v1/organizations/{org}/developers?count=1300' \
-H 'Authorization: Basic '

 

For the second one - stats API there is limit=14400, and when you're aggregating sum of traffic based on timeUnit=month it won't exceed the limit of the developers you have. If it still exceeds the limit then you can use offset with stats API.

 

 

Hi Chris, 

No it will not work, the maximum it can work only for 1000, and then you need to repeat the call.