Hi,
We have plenty of proxies in Development environment including all kind of tryout or helloworlds etc..
There are multiple API developers who have access to development environment.
If I have the exercise to clean up or delete the proxies not in use in development environment and want to know who is the API developer who created listed proxies by looking at proxies. Is it possible ?
I do have access to delete all proxies but would like to know who created API and if not use in future just delete them
I can look into analytics or performance information of each API but in certain decision to delte will have to indicate to creator..
Solved! Go to Solution.
Not exactly what you want, but I wrote this utility that uses the Analytics to list the proxies that has had no traffic. See if that helps and then you can use that list and delete the proxies. The tool is called ApigeeBundleReaper
The information you seek is in the audit trail.
You will need to query the audit stream for your organization, and then find the API proxies in those results. The audit records are stored in time order. So the way to approach it is:
The audit query looks like this:
curl -i -n "https://api.enterprise.apigee.com/v1/audits/organizations/$ORG?endTime=1449105607514&expand=true&startTime=1446513607514"
You need to specify the endTime and startTime in "milliseconds since epoch".
The records that cover API Proxies look like this:
CREATE (import)
{ "operation": "CREATE", "request": "''ORGNAME''", "requestUri": "/v1/o/ORGNAME/apis/PROXYNAME/?action=import&name=PROXYNAME", "responseCode": "201", "timeStamp": 1528146834481, "user": "dchiesa@google.com" }
UPDATE:
{ "operation": "UPDATE", "request": "''ORGNAME''", "requestUri": "/v1/organizations/ORGNAME/apis/PROXYNME/revisions/1?validate=true", "responseCode": "200", "timeStamp": 1528218325640, "user": "dchiesa@google.com", }
I wrote a tool that does this in nodejs. findLastEditor
example usage:
node ./findLastEditorOfProxy.js -o $ORG -v -P proxy1 -P proxy2 ...
It queries the audit trail, searching for the most recent record for each proxy according to the steps I described above. At completion, it emits the list of proxies you specified, with the most recent audit record for creation or update of that API Proxy.
Deployment or undeployment actions are stored in the Audit trail as well. This tool does not count those as a create/update events. If you want to know who last deployed the proxy, that's a different audit record. If you were interested in that, you could create a modified version of this tool to look for deployment records.