StatisticCollector or VerifyAPIKey not setting flow variables

I'm trying to collect developer and product information to use in analytics through the flow variables naturally set by VerifyAPIKey, but whenever I dump the data into BigQuery, I see that all the corresponding fields are (not set) or null. This is the StatisticsCollector policy that runs right after VerifyAPIKey:

<StatisticsCollector name="collect-stats">
    <Statistics>
        <Statistic name="dev_app" ref="verifyapikey.verify-api-key.developer.app.name" type="string">N/A</Statistic>
        <Statistic name="api_prod" ref="verifyapikey.verify-api-key.apiproduct.name" type="string">N/A</Statistic>
        <Statistic name="KEY_client_id" ref="verifyapikey.verify-api-key.client_id" type="string">N/A</Statistic>
    </Statistics>
</StatisticsCollector>

Any ideas how to fix this issue?

Solved Solved
0 3 199
1 ACCEPTED SOLUTION

chawkimatta
Participant III

@Daniel Silva The following variables are automatically populated in Analytics when a Verify API Key policy is enforced for a valid API key. These variables are only populated by the Verify API Key policy and the OAuth policies. (common dimensions)

The variables and values can be used as dimensions to build Analytics reports to gain visibility into consumption patterns by developers and apps.

  • apiproduct.name
  • developer.app.name
  • client_id
  • developer.id

View solution in original post

3 REPLIES 3

Can you also show the VerifyApiKey policy please?

chawkimatta
Participant III

make sure your "policy_name" is "verify-api-key".

the flow variable should be like: verifyapikey.{policy_name}.developer.app.name

chawkimatta
Participant III

@Daniel Silva The following variables are automatically populated in Analytics when a Verify API Key policy is enforced for a valid API key. These variables are only populated by the Verify API Key policy and the OAuth policies. (common dimensions)

The variables and values can be used as dimensions to build Analytics reports to gain visibility into consumption patterns by developers and apps.

  • apiproduct.name
  • developer.app.name
  • client_id
  • developer.id