Greg Smith We are very sorry for the delayed response. I am able to confirm that even with "copy" mode in send-request
policy, APIM won't the copy the body of the original request and hence the input will be null with the liquid template above.
The workaround is to create a variable with required values from the request body and use it in the liquid template as shown below (based on sample policy snippet: https://github.com/Azure/api-management-policy-snippets/blob/master/examples/Extracting%20multiple%20values%20from%20xml%20documents.policy.xml):
<inbound>
<base />
<set-variable name="jsonBody" value="@{
var bodyObj = context.Request.Body.As<JObject>(preserveContent:true);
var obj = new JObject();
obj["ccUsers"] = (JArray)bodyObj["ccUsers"];
return obj;
}" />
<send-request mode="copy" response-variable-name="varCCs">
<set-url>http://contoso.com</set-url>
<set-method>POST</set-method>
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body template="liquid">
{% assign vars = context.Variables["jsonBody"] %}
[{%JSONArrayFor item in vars["ccUsers"] %}"{{item}}"{% endJSONArrayFor %}]
</set-body>
</send-request>
</inbound>
We will add a note to our doc to specify this limitation and if you have feedback regarding this feature, please submit it via https://aka.ms/apimwish and others can upvote your feature too. This will help our product team prioritize the features.
I hope this helps with your question and let me know if you have any questions. I would be happy to answer any.
If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience.