Extract Varibale Policy in Apigee is not propagated web api through the target path

16 views Asked by At

I have a web api endpoint in below format

"h t t p s://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.

    EV-Get_Variables_Subject request **/school/{subject} **/school/{subject}/details urirequest true

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

There are 0 answers