Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get the Action Value of APIKit Router Mapping in Mule 4

Say this is my router config

<apikit:config name="apiConfig" raml="api.raml" doc:name="Router" >
   <apikit:flow-mapping resource="/resourceOne" action="get" flow-ref="flow-1"/>
   <apikit:flow-mapping resource="/resourceTwo" action="post" flow-ref="flow-1"/>
</apikit:config>

As you can see the calls to these two resources are being redirected to the same flow, but based on the method action.

How do I read this action value (Get or Post) in the called flow flow-1?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I believe you should be having separate flows, but if you need to it this way, you can use #[attributes.method] to get the method of the HTTP Request. The APIKIT router will forward the same event that the HTTP Listener will receive, so it will contain HTTPRequestAttributes. For more info you can refer this section HTTP Request Example

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading