How can we improve Azure API Management?

Support building multipart/form-data in Policy Expressions for legacy apis

Ability to build multipart/form-data requests from an originating non-multipart request. Ideally, the json-to-xml converter would also be able to be used. Use case is legacy API for querying that accepts xml files submitted via multipart POST. Would like to expose as standard json service (no multipart)-or at least standard non-multipart xml service. Presumably adding multipart support would involve some additions to the available Policies.

24 votes
Vote
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
You have left! (?) (thinking…)
Anne Epstein shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
  • Adam Weigert commented  ·   ·  Flag as inappropriate

    On another note, it would be nice if this used UrlDecode on the value.

    Current workaround I am using to get the urlencoded parameter:

    @(context.Request.Body.As<string>(preserveContent:true).Split('&').Where(s => s.StartsWith("param1=", StringComparison.OrdinalIgnoreCase)).Select(s => s.Split('=').Skip(1).FirstOrDefault()).FirstOrDefault()

    Use case is when you need to exact the parameter for another use, e.g. throttling policy, send-request, etc...

  • Adam Weigert commented  ·   ·  Flag as inappropriate

    Allow parsing of the request body that uses a content type of x-www-form-urlencoded.

    Example:
    Body: param1=xyz&param2=123
    Expression: @(context.Request.Body.AsForm().GetValueOrDefault('param1'))
    Output: xyz

Feedback and Knowledge Base