Tools, FAQ, Tutorials:
'set-variable' Statement to Create Custom Variables
How to use the "set-variable" Policy Statement to create custom variables for an Azure API service operation?
✍: FYIcenter.com
The "set-variable" policy statement allows you to create custom variables with given values
to be used later in other policy statements.
The "set-variable" statement has the following syntax:
<set-variable name="variable_name" value="Expression | Text" />
If a "@(...)" expression is used, the variable have hold the objects returned from the expression in a number of C# types, like System.Boolean, System.Int32, System.Single, System.Double, System.String, System.DateTime, etc.
For example, the following inbound policy creates three variables: the first one with a text as its value; the second one with a "@(...)" expression returning a Boolean; the third one with a "@(...)" expression returning a String;
<inbound>
<set-variable name="version" value="1.11"/>
<set-variable name="isMobile"
value="@(context.Request.Headers["User-Agent"].Contains("iPad"))"/>
<set-variable name="method" value="@(context.Request.Method)"/>
</inbound>
For more information on "set-variable" statement, see API Management policy expressions Website.
⇒ Use Custom Variables in Policy Expressions
2018-01-24, ≈12🔥, 0💬
Popular Posts:
How To Get the Minimum or Maximum Value of an Array in PHP? If you want to get the minimum or maximu...
How to add request query string Parameters to my Azure API operation to make it more user friendly? ...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...
How To Truncate an Array in PHP? If you want to remove a chunk of values from an array, you can use ...
What Is session_register() in PHP? session_register() is old function that registers global variable...