Chapter 3. Viewing and editing Rest DSL components

download PDF

Apache Camel supports multiple approaches to defining REST services. In particular, Apache Camel provides the REST DSL (Domain Specific Language), which is a simple but powerful API that can be layered over any REST component and provides integration with the OpenAPI 2.0 specification. OpenAPI (formerly Swagger) is a vendor-neutral and portable open description format for API services.

For information about using the Camel Rest DSL, see the “Defining REST services” chapter of the Apache Camel Development Guide.

With the Fuse Tooling, you can view and edit Rest DSL components that are in your Camel Context file.

You can also configure your Fuse Integration project to expose your REST API to an OpenAPI client as described here:

3.1. Viewing a graphical representation of Rest DSL components

To view the REST DSL components in your Camel Context file in graphical mode:

  1. Open the Camel Context file in the route editor.
  2. Click the REST tab to the view the Rest DSL components.


    The REST Configuration section displays these configuration options:

    • Component — The Camel component to use for the REST transport.
    • Context Path — The leading context-path for the REST services. You can use this option for components, such as Servlet, where the web application is deployed using a context-path.
    • Port — The port number that exposes the REST service.
    • Binding Mode — The binding mode for JSON or XML format messages. Possible values are: off (the default), auto, json, xml, or json_xml.
    • Host — The hostname to use for exposing the REST service.
  3. Click a REST element to view its associated operations (for example, GET, POST, PUT, and DELETE) in the REST Operations section.
  4. Click a REST element or a REST operation to view its properties in the Properties view.


3.2. Editing Rest DSL components in the graphical view

You can add, edit, or delete REST elements in your project’s Camel Context file in the REST tab.

  • To add a new REST element:

    1. In the REST elements section, click the + button. A REST element is added to the list of REST elements.

    2. In the Properties view, edit the REST element properties.

  • To add a REST operation to a REST element:

    1. In the list of REST elements, select a REST element.

    2. In the REST operations section, click the + button.

      The Add REST Operation dialog box opens.

    3. Specify the ID, URI, and Operation Type. Optionally, select a Referenced Route ID.
    4. Click Finish. The new operation shows in the list of REST operations for the selected REST element.
  • To edit a REST element or operation, select it in the REST tab and then edit its property values in the Properties tab.
  • To remove a selected REST element or operation, click the x button.

3.3. Viewing and editing the Rest DSL source code

You can also view and edit Rest DSL components in the Source tab:

  1. Open the Camel Context file in the route editor.
  2. Click the route editor’s Source tab and then edit the code.

  3. Optionally, click the REST tab to see the changes in the graphical view.
  4. To save your changes, select File Save.
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.