I want to rate lime based on the mailTo
attribute from the request body.
Here is the APIM policy
<rate-limit-by-key calls="5"
renewal-period="10"
counter-key="@(context.Request.Body.As<JObject>()["mailTo"].ToString())" />
Here is the request body
{
"mailTo": "myemail@gmail.com"
}
This work fine for direct call to backend, but getting below error while calling to APIM
{
"errors": {
"": [
"A non-empty request body is required."
]
},
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-......-3be881755d918044-00"
}`
<rate-limit-by-key calls="5"
renewal-period="10"
counter-key="@(context.Request.Body.As<JObject>()["mailTo"].ToString())" />