Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.

Rest Component

Available as of Camel 2.14

The rest component allows to define REST endpoints using the Rest DSL and plugin to other Camel components as the REST transport.


URI format


URI Options


Default Value




HTTP method which should be one of:

  • get
  • post
  • put
  • patch
  • delete
  • head
  • trace
  • connect
  • options



The base path which support REST syntax.

See further below for examples.



URI template which support REST syntax.

See further below for examples.



Media type such as: text/xml or application/json this REST service accepts.

By default we accept all kinds of types.



Media type such as: text/xml or application/json this REST service returns.

Path and uriTemplate syntax

The path and uriTemplate option is defined using a REST syntax where you define the REST context path using support for parameters. 

If no uriTemplate is configured then path option works the same way. It does not matter if you configure only path or if you configure both options. Though configuring both a path and uriTemplate is a more common practice with REST.


The following is a Camel route using a a path only

    .transform().constant("Bye World");

And the following route uses a parameter which is mapped to a Camel header with the key me:

    .transform().simple("Bye ${}");

The following examples have configured a base path as hello and then have two REST services configured using uriTemplate's.


    .transform().simple("Hi ${}");
    .transform().simple("Bonjour ${}");

More examples

See Rest DSL which offers more examples and how you can use the Rest DSL to define those in a nicer RESTful way.

There is a camel-example-servlet-rest-tomcat example in the Apache Camel distribution, that demonstrates how to use the Rest DSL with SERVLET as transport that can be deployed on Apache Tomcat, or similar web containers.

© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram