REST Component Reference
|Mule Runtime Engine versions 3.5, 3.6, and 3.7 reached End of Life on or before January 25, 2020. For more information, contact your Customer Success Manager to determine how you can 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.
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 porxy an existing REST API, read Proxying Your API.