Azure API Extract <send-request> policy's response status code

660 views Asked by At

I'm making request using policy.. I need to check the status code of that request

I tried using

<choose>
  <when condition="@(((IResponse)context.Variables["LogFailedEvent"]).StatusCode != 200)">
  </when>
</choose>

even

<choose>
  <when condition="@(context.Response.StatusCode != 200)">
  </when>
</choose>

but it throws error like key not present in dictionary anyone have idea/solution?

1

There are 1 answers

0
Vitaliy Kurokhtin On

If ignore-error attribute is set to "true" in your send-request policy, APIM will continue without setting response variable to anything. Trace your call using Test console in Azure portal to see where and why it breaks.