Apache Camel Example using Swagger

This example shows how to use Servlet REST to define REST endpoints in Camel routes using the Rest DSL in XML, and using camel-swagger-java to expose the REST service APIs.
This example is implemented in XML DSL.
The XML DSL the routes are define in XML code, in the src/main/resources/camel-config-xml.xml file.

There is a user REST service that supports the following operations

The view operations are HTTP GET, and update is using HTTP PUT. From a web browser you can access the first two services using the following links From the command shell you can use curl to access the service as shown below:
    curl -X GET -H "Accept: application/json" http://localhost:8080/camel-example-swagger-xml/rest/user/123
    curl -X GET -H "Accept: application/json" http://localhost:8080/camel-example-swagger-xml/rest/user/findAll
    curl -X PUT -d "{ \"id\": 666, \"name\": \"The devil\"}" -H "Accept: application/json" http://localhost:8080/camel-example-swagger-xml/rest/user
Notice when trying to get user with id 789 then there is a built-in delay of 0.5-2 seconds, to simulate some slowness in the service.

This example offers an API browser using Swagger which is accessible from the following link

To use the swagger ui, follow this link. Replace the URL value with this one to access the REST local resources http://localhost:8080/camel-example-swagger-xml/rest/api-docs/myCamel

If you hit any problems please let us know on the Camel Forums

Please help us make Apache Camel better - we appreciate any feedback you may have. Enjoy!

The Camel riders!