MuleSoft Tips: Calling other APIs

When calling other web service APIs specially if they are REST MuleSoft based I use the AnyPoint Platform to generate a connector for that API rather than using HTTP module Request. It is a better way to connect to other APIs rather than using HTTP request. As, it would generate the request parameters and any payload schemas for you. That way you are sure that you pass all the parameters to the called service. In addition, it takes care of the correlation ID for you too, which greatly helps with tracing and debugging. And if the API is updated (include authorization for example) then you update the connector. 

If the API is not in MuleSoft based or you need to upload its definition first to the AnyPoint Platform Exchange. Then, to generate the connector in the AnyPoint Studio go to the palate and  click ( Seacrh in Exchange). 

No alt text provided for this image

Then Search in Exchange for the name of the API or select it and click finish.

No alt text provided for this image

This will generate the connector for you, and you can simply use it as shown in the images below.

No alt text provided for this image

Figure 1: Using the generated connector operation in a connector

No alt text provided for this image

Figure 2: Connector Details

 

Deb Mukherjee

Specialist Senior at Deloitte

1 年

nice.when would we use http request instead of rest connector in mule4?

回复

要查看或添加评论,请登录

MOUSTAFA REFAAT的更多文章

社区洞察

其他会员也浏览了