Last active
May 21, 2025 14:31
-
-
Save DaRiv94/2ce245fe9c4e05d0d14b19517c81f61c to your computer and use it in GitHub Desktop.
Azure API Management Conditional Transformation Policy Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <choose> | |
| <when condition="@(context.Response.StatusCode == 200 && context.Product?.Name != "Unlimited")"> | |
| <set-body>@{ | |
| var response = context.Response.Body.As<JObject>(); | |
| foreach (var key in new [] {"hair_color", "skin_color", "eye_color", "gender"}) { | |
| response.Property(key).Remove(); | |
| } | |
| return response.ToString(); | |
| } | |
| </set-body> | |
| </when> | |
| </choose> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great