How to extract a Developer custom attribute to use in Assign Message in Apigee

I'm new to google apigee and need some help.

I'm trying to get a custom attribute defined in Developer page to use it in an assign message policy to add it in the header of the target endpoint.

Can anyone help me with it?

I've tried some extract value policies, but without success.

 

2024-01-23_16-11-22.png

0 1 60
1 REPLY 1

When you have an API proxy that performs some kind of credential validation - for example using the VerifyAPIKey policy or using OAuthV2/VerifyAccessToken - some of the custom attributes of the various entities are implicitly loaded into context, so that they're accessible as context variables. These are attributes associated to the app or the product entities. This screencast talks through how it works for custom attributes on API Products. https://www.youtube.com/watch?v=O_ywuyH9hVM

But for the attributes on a developer, you need to take an extra step to load those attributes into context. That step is AccessEntity. Include an AccessEntity policy after you've verified credentials.

 

<AccessEntity name='AE-Dev'>
  <EntityType value='developer' />
  <EntityIdentifier type='consumerkey' ref='client_id' />
</AccessEntity>

 

And then you should be able to use ExtractVariables to get the attribute. (Or, check debugsession/trace, you may have a specific variable that holds the attribute, even without ExtractVariables).

good luck.

edit: I recorded a quick screencast showing how this works: https://www.youtube.com/watch?v=4r7meUsZavU
From your screenshot, it looks like you're using OPDK. While my screencast shows Apigee X, the combination of AccessEntity and ExtractVariables works the same in OPDK as it does in X.