cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with ExtractVariables in API management

former_member186078
Active Participant
0 Kudos

Hello Everyone,

I am trying to do a very simple thing of setting a variable in API management with a pattern or data coming from another variable and facing issue when saving the API proxy. Here is the simple code I am using:

<!-- Extract content from the request or response messages, including headers, URI paths, JSON/XML payloads, form parameters, and query parameters -->
<ExtractVariables async="false" continueOnError="false" enabled="true" xmlns='http://www.sap.com/apimgmt'>
	<!-- the source variable which should be parsed -->
    <Variable name="jwks_response.content">
        <Pattern>{okta_jwks}</Pattern>
    </Variable>
</ExtractVariables>

The objective of the code is to read the value from jwks_content and set the variable okta_jwks.

It always gives me the error that "Unable to update API and the detail description is Unable to parse the policy Store-JWKS-response-content-in-variable; Invalid policy content. Element 'Variable' must have no element [children], and the value must be valid.. Verify policy xml file."

When I look at the standard documentation >https://help.sap.com/viewer/66d066d903c2473f81ec33acfe2ccdb4/Cloud/en-US/dad6ef6e8bf444819cd5e26b649..., I feel that I am doing write, but I am unable to understand what is going wrong with this.

View Entire Topic
ElijahM
Advisor
Advisor
0 Kudos

Hi Adithya,

Sorry I thought that I had posted this earlier but it went to draft. Currently you will need to follow a specific format to use extract variable. I believe you will need to specify a source in your configuration, to tell API Management where to find the information being extracted (this can be request, response, or some . Then you must specify within the source data what you are attempting to extract (URI, Header, JSONPayload, XMLPayload, etc.) to assign to the variable.

This is why the docu example shows

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="true" continueOnError="false" enabled="true" xmlns="http://www.sap.com/apimgmt">
    <Source>AccessEntity.GetDeveloperProfile</Source>
    <XMLPayload>
        <Variable name="email" type="string">
            <XPath>/Developer/Email</XPath>
        </Variable>
    </XMLPayload>
</ExtractVariables>

Pattern is a child element of the listed parent elements. If you would like more assistance with the formatting of the XSD let us know - we can provide examples.

Regards,
Elijah