REST Component Reference
Mule runtime engine version 3.8 reached its End of Life on November 16, 2021. For more information, contact your Customer Success Manager to determine how to migrate to the latest Mule version. |
Purpose: Use a REST API to publish an external RESTful web service.
Minimum Configuration: Specify the REST component or resource class.
A REST component publishes a RESTful web service via JAX-RS annotations and using Jersey. In addition to specifying the REST component class, you can also configure an exception mapper and a interceptor.
Note that REST is a formal HTTP architecture based on resources, links, and a uniform interface. As such, it uses the HTTP protocol.
Mule hosts RESTful web services using Jersey, which is a JAX-RS (JSR-311) implementation. JAX-RS is a specification that provides a series of annotations and classes that make it possible to build RESTful services.
Generally, you add a REST component to an connector. If you add the REST component to a request-response connector, such as an HTTP connector, Anypoint Studio generates a REST request-response component, as shown below.
If you add the REST component to a one-way connector, such as a File connector, then Anypoint Studio generates a REST one-way component.
Open the REST component’s Properties Editor. Use the General tab to specify the reference to the REST component or resource and, if you are using exception mapping, the class implementing this mapping.
See Also
-
For an overview on the recommended ways to publish and consume REST services, see Publishing and Consuming APIs with Mule
-
If you want to publish a REST API service, read about the API Manager to find out about a whole set of tools that will make this easier.
-
If you intend to set up a proxy for an existing REST API, read Setting up a proxyProxy.