In Apigee, how to get a custom attribute value for a developer using an AccessEntity policy and then in Javascript?

There is a special attribute assigned to the developer called "XYZ". You can use the AccessEntity policy in the proxy API (along with the AssignMessage and ExtractVariable policies in the tutorial: http://apigee.com/docs/api-services/content/retrieve-entity-profiles-using-accessentity ) to use get the value for him so that you can access it in javascript? The example provided in the training document is not very clear.

I have the following configurations that do not work. "XYZ" is the name of the custom developer attribute:

AccessEntity Policy -

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AccessEntity async="false" continueOnError="false" enabled="true" name="access-developer-attribute">
    <DisplayName>AccessEntity Developer Attribute</DisplayName>
    <FaultRules/>
    <Properties/>
    <EntityIdentifier ref="XYZ"></EntityIdentifier>
    <EntityType value="developer"></EntityType>
</AccessEntity>

AssignMessage Policy -

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="convert-accessentity-xml-to-message-request">
    <DisplayName>Convert AccessEntity Xml To Message Request</DisplayName>
    <FaultRules/>
    <Properties/>
    <Set>
        <Headers/>
        <QueryParams/>
        <FormParams/>
        <Verb/>
        <Path/>
        <Payload type="text/xml">AccessEntity.access-developer-attribute</Payload>
    </Set>
    <AssignVariable>
        <Name>name</Name>
        <Value/>
        <Ref/>
    </AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="true" transport="http" type="request">accessentity.XYZ-attribute</AssignTo> 
</AssignMessage>

ExtractVariables -

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="retrieve-developer-attribute">
    <DisplayName>Retrieve Developer Domain</DisplayName>
    <FaultRules/>
    <Properties/>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <Source>accessentity.XYZ-attribute</Source> 
    <VariablePrefix>developer_attribute</VariablePrefix>
    <XMLPayload stopPayloadProcessing="false">
        <Namespaces/>
        <Variable name="xyz" type="string">
            <XPath>/Developer/Attributes/XYZ</XPath>
        </Variable>
    </XMLPayload>
</ExtractVariables>

Javascript -

var xyzValue = context.getVariable("developer_attribute.xyz");
+3
1

EntityIdentifier ref AccessEntity , . , , (developeremail, , appid, consumerkey). , EntityIdentifier. client_id:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AccessEntity async="false" continueOnError="false" enabled="true" name="access-developer-attribute">
    <DisplayName>AccessEntity Developer Attribute</DisplayName>
    <EntityIdentifier ref="client_id" type="consumerkey"></EntityIdentifier>
    <EntityType value="developer"></EntityType>
</AccessEntity>

, AssignMessage AccessEntity.access-developers. , "AccessEntity.access-development-attribute".

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="convert-accessentity-xml-to-message-request">
    <DisplayName>Convert AccessEntity Xml To Message Request</DisplayName>
    <Set>
        <Payload type="text/xml">{AccessEntity.access-developer-attribute}</Payload>
    </Set>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="true" transport="http" type="request">accessentity.XYZ-attribute</AssignTo> 
</AssignMessage>

, . .

ExtractVariables JavaScript .

+1

All Articles