Good Day,
I am trying to store the incoming JSON payload into the Azure API Manager internal cache using the "cache-store-value" policy. The key will be one of the field coming inside the payload. I am able to extract the key but when I am trying to store the payload I am getting the error
"Expression evaluation failed. Object reference not set to an instance of an object."
Here is the code I am writing
<policies>
<inbound>
<base />
<set-variable name="processIdKey" value="@((string)context.Request.Body.As<JObject>()["id"])" />
<set-variable name="validationResults" value="@(context.Request.Body.As<JObject>())" />
<cache-store-value key="@((string)context.Variables["processIdKey"])" value="@((string)context.Variables["validationResults"])" duration="30" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
I later need to extract the value in another method of the api so need to know how to store the JSON payload in the cache and extract the same to send as a response in another method.
Thanks in advance for your help.