Summary
Learn how use 'PATCH' method HTTP Adaper CPI
Introduction
These days I had some trouble with a requirement of an
iflow trying connect to a
Rest API through
'PATCH' method. So, I want to share how I overcome this requirement.
Problem:
- How HTTP adapter looks like
Picture 1
- Some methods are available on CPI as we can see picture 2 and looking in other tool like postman(picture 3) we can see other possibilities.
Picture 2
Picture 3
- So, when I try to send a message with any of these methods available on CPI to the endpoint with "PATCH" method I got a message like "method not allowed"
Solution:
- To solve that we need to create a "Content Modifier" declaring the header camel property "CamelHttpMethod" and the source value need to be filled with a method of your need, in my case was "PATCH".
Picture 4
- After that, just need to adjust the Adapter choosing a dynamic method, insert the expression "${header.CamelHttpMethod}" and deploy your iflow
Picture 5
Hope that help you as helped me.
Hope, you like the post, I am looking forward to receiving your comments to the post!
Regards,
Henrique Cordeiro