What is API Management Context Request MatchedParameters?


The API Management public documentation for the request context variable usable in policy expressions at https://docs.microsoft.com/en-us/azure/api-management/api-management-policy-expressions#ContextVariables declares a property MatchedParameters: IReadOnlyDictionary<string, string> which is a bit ambiguous. Here is some insight learned from Vitalli Kurokhtin.

MatchedParameters collection captures (and only captures) parameters that were present in operation UrlTemplate. Those are path and/or query parameters, but only those query parameters that are in template. So if you have template as:

/user/{uid}/credentials?include={include}

And make request as:

/user/1/credentials?include=password&hash=true

MatchedParameters will have:

uid:1
include:password

Url.Query on the other hand will have:

include:password
hash:true

See the operation contract's UrlTemplate parameter at https://docs.microsoft.com/en-us/rest/api/apimanagement/apioperation/get#operationcontract

Comments (0)

Skip to main content