In Route rule, How to condition based on the request payload/data ?,In Route Rule, how to condition a JSON request data which is present inside the array?

Hi All,

I want to route the request to different target environment based on the data in the JSON request

from the data UserRequest-->CustomerDetails-->Address (array) -->AddressType

Could any one tell me how to condition on the request payload?

Thanks,

Murugan

Solved Solved
0 2 1,820
1 ACCEPTED SOLUTION

robert
Participant V

Hi @poomuruganpoopandian,

To accomplish this task, use an extract variable policy and set a variable with the JSONPayload tag. From there you can create a route rule with a condition comparing the extracted variable like this:

<RouteRule name="MyRoute">
	<Condition>myExtractedVariable equals "value I'm looking for"
	</Condition>
	<TargetEndpoint>TargetEndpoint1</TargetEndpoint>
</RouteRule>

If I answered your question, please click accept.

View solution in original post

2 REPLIES 2

robert
Participant V

Hi @poomuruganpoopandian,

To accomplish this task, use an extract variable policy and set a variable with the JSONPayload tag. From there you can create a route rule with a condition comparing the extracted variable like this:

<RouteRule name="MyRoute">
	<Condition>myExtractedVariable equals "value I'm looking for"
	</Condition>
	<TargetEndpoint>TargetEndpoint1</TargetEndpoint>
</RouteRule>

If I answered your question, please click accept.

Hi Robert,

Thank you, its working. I am able to extract the variable from request and route the flow to different endpoint