Extract Varibale in Apigee is not propagated to the target path.

Hi All,

I have a web api endpoint  in below format

https://domain.com/v1/school/{subject}/details

1. In the above URI, the {subject} path is dynamic and user defined.

2. I have used Extract variable policy to the the subject content as below.

<ExtractVariables async="false" continueOnError="false" enabled="true" name="EV-Get_Variables_Subject">
<DisplayName>EV-Get_Variables_Subject</DisplayName>
<Source clearPayload="false">request</Source>
<URIPath>
<Pattern ignoreCase="true">**/school/{subject}</Pattern>
<Pattern ignoreCase="true">**/school/{subject}/details</Pattern>
</URIPath>
<VariablePrefix>urirequest</VariablePrefix>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</ExtractVariables>

And below is the assign message policy

<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-Set_TargetPath_School">
<DisplayName>AM-Set_TargetPath_School</DisplayName>
<Properties/>
<AssignVariable>
<Name>targetPath</Name>
<Value>/school/{urirequest.subject}/details</Value>
</AssignVariable>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

When I print the content of the Extract variable in the javascript policy. I can see the value. But when the request goes to the target server the value for subject is received as "{urirequest.subject}" and not the value.

I get below custom error

"Invalid Subject Parameter- Subject: {urirequest.subject}"
 
And API method is
[Produces("application/json")]
[HttpGet("school/{subject}/details")]
public async Task<IActionResult> SubjectDetailsAsync([FromRoute]string subject, [Required] int Id, [Required] string caller, CancellationToken cancellationToken){ " method content " }

 

0 0 35
0 REPLIES 0