How can I get the client_id/developer ID (email address) for a particular API request/transaction ?

We would like to get the client_id/developer ID (email address) for a particular API request. We do have the message_id for the particular API request from the router log.

Can someone help me to get this information ?

0 3 432
3 REPLIES 3

Considering that we know the message_id for the particular API request, we can get the client_id, developer email address from the Analtyics/Postgres database using the following steps:

1. Login to Postgresql

<install_dir>/psql -h /opt/apigee/var/run/apigee-postgresql -U apigee apigee 

2. Run the following query:

select apiproxy, request_uri, client_received_start_timestamp, access_token, client_id, developer, developer_email, gateway_flow_id from analytics."<org-name>.<env-name>.fact" where gateway_flow_id='<message_id>' 

Note: Replace the <org-name>, <env-name>, <message_id> with the actual values. If you want to get any other details for the particular API request, you can add the relevant fields from the fact table to the above query.

Alternatively, when you validate an API Key or OAuth Token then this information is populated at Context Variables. You can then use the Message Logging policy or Analytics to identify requests from a given client id or developer id. This will save you from having to query postgres directly.

Many thanks, Sean

@Sean Davis,

Thanks for your answer. But the customer wanted to get the information for a specific request that was made for an API Proxy which didn't have the Message Logging policy.