Quick way to find the Developer App associated with a particular Consumer Key

In some cases, you may wish for a "quick and dirty" way to search through Developer Apps for a specific key. You can bypass the UI and loop through all apps, then search the results.

The procedure would look as follows:

Issue the following Shell command (replace ORG_NAME accordingly):

$ myOrg="ORG_NAME" ; for a in $(curl -u $USERID:$PASSWORD -s -H 'Accept: application/xml' https://api.enterprise.apigee.com/v1/o/${myOrg}/apps | grep "<Item>" | sed  s/\<Item\>// | sed  s#\</Item\>## | sed -e 's/^[ \t]*//') ; do curl -u $USERID:$PASSWORD -s -H 'Accept: application/xml' https://api.enterprise.apigee.com/v1/o/${myOrg}/apps/$a ; done

The above should produce output for every app. You then only need to search through it for the desired key.

Comments
ceber
Staff

Cool! Tips like these are some of my favorite little API tricks. Here's an alternate way, if you already have jq installed. jq is pretty handy little command-line json tool. find it here: http://stedolan.github.io/jq

curl -u $USERID https://api.enterprise.apigee.com/v1/o/${myOrg}/apps?expand=true | jq '.app | map(select(.credentials[0].consumerKey == "${keyToFind}" ))'
Version history
Last update:
‎02-17-2015 02:44 PM
Updated by: