// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-rest"]
= Rest
:page-aliases: extensions/rest.adoc
:linkattrs:
:cq-artifact-id: camel-quarkus-rest
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Expose REST services and their OpenAPI Specification or call external REST services.
:cq-deprecated: false
:cq-jvm-since: 0.0.1
:cq-native-since: 0.0.1

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##0.0.1## [.badge-key]##Native since##[.badge-supported]##0.0.1##
endif::[]

Expose REST services and their OpenAPI Specification or call external REST services.

[id="extensions-rest-whats-inside"]
== What's inside

* xref:{cq-camel-components}::rest-component.adoc[REST component], URI syntax: `rest:method:path:uriTemplate`
* xref:{cq-camel-components}::rest-api-component.adoc[REST API component], URI syntax: `rest-api:path`

Please refer to the above links for usage and configuration details.

[id="extensions-rest-maven-coordinates"]
== Maven coordinates

https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-rest[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-rest</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]

[id="extensions-rest-additional-camel-quarkus-configuration"]
== Additional Camel Quarkus configuration

This extension depends on the xref:reference/extensions/platform-http.adoc[Platform HTTP] extension
and configures it as the component that provides the REST transport.

[id="extensions-rest-configuration-path-parameters-containing-special-characters-with-platform-http"]
=== Path parameters containing special characters with platform-http

When using the `platform-http` REST transport, some characters are not allowed within path parameter names. This includes the '-' and '$' characters.

In order to make the below example REST `/dashed/param` route work correctly, a system property is required `io.vertx.web.route.param.extended-pattern=true`.

[source,java]
----
import org.apache.camel.builder.RouteBuilder;

public class CamelRoute extends RouteBuilder {

    @Override
    public void configure() {
        rest("/api")
            // Dash '-' is not allowed by default
            .get("/dashed/param/{my-param}")
            .to("direct:greet")

            // The non-dashed path parameter works by default
            .get("/undashed/param/{myParam}")
            .to("direct:greet");

            from("direct:greet")
                .setBody(constant("Hello World"));
    }
}
----

There is some more background to this in the https://vertx.io/docs/vertx-web/java/#_capturing_path_parameters[Vert.x Web documentation].

[id="extensions-rest-configuration-configuring-alternate-rest-transport-providers"]
=== Configuring alternate REST transport providers

To use another REST transport provider, such as `netty-http` or `servlet`, you need to add the respective
extension as a dependency to your project and set the provider in your `RouteBuilder`. E.g. for `servlet`, you'd
have to add the `org.apache.camel.quarkus:camel-quarkus-servlet` dependency and the set the provider as
follows:

[source,java]
----
import org.apache.camel.builder.RouteBuilder;

public class CamelRoute extends RouteBuilder {

    @Override
    public void configure() {
        restConfiguration()
                .component("servlet");
        ...
    }
}
----

