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).
Then Search in Exchange for the name of the API or select it and click finish.
This will generate the connector for you, and you can simply use it as shown in the images below.
Figure 1: Using the generated connector operation in a connector
Figure 2: Connector Details
Specialist Senior at Deloitte
1 年nice.when would we use http request instead of rest connector in mule4?