1

I'm trying to publish a backend SOAP service as a REST service through Azure API Management. I already managed to publish it, but now I want to transform my backend POST operation to a GET. I use a liquid template to create my XML request message and I'm able to get my query parameters using

context.Request.MatchedParameters["parameter"]

One of my parameters is an array that is comma separated

http://myservice.com/service?arrayParam=value1,value2

A bit like this. But I can't find a way to split my string value. What I have already tried is

<% assign values=context.Request.MatchedParameters["arrayParam"] | split: "," %>
<% for item in values%>
<value>{{item}}</value>
<% endfor %>

But strangly, this is splitting my array in single characters. I also tried

<% assign values=context.Request.MatchedParameters["arrayParam"].Split(",")%>
<% for item in values%>
<value>{{item}}</value>
<% endfor %>

But no luck uptill now. Can somebody help me in the right direction please?

Kind Regards Tim

Tim D'haeyer
  • 584
  • 6
  • 19

1 Answers1

1

Liquid Filters are using the C# naming convention, so you will need to use "Split" instead of "split".

This issue has tripped so many people up. Maybe it's time for a PR to dotLiquid to make filters case insensitive.

Darrel Miller
  • 139,164
  • 32
  • 194
  • 243
  • Thanks. That was not something I would have figured out myself. :-) – Tim D'haeyer Sep 13 '17 at 12:57
  • @TimD'haeyer We tried calling it out in the docs https://learn.microsoft.com/en-us/azure/api-management/api-management-transformation-policies#SetBody but it is really, really easy to miss. – Darrel Miller Sep 13 '17 at 13:23