Using a URI Template

If include some properties of the object in the URI, you can use a URI template.

For example imagine you have a Book class with a title property. You can include the title in the URI template and then populate it from an instance of Book. For example:

Sending a JSON body with a URI template

  1. Flux<HttpResponse<Book>> call = Flux.from(client.exchange(
  2. POST("/amazon/book/{title}", new Book("The Stand")),
  3. Book.class
  4. ));

Sending a JSON body with a URI template

  1. Flux<HttpResponse<Book>> call = client.exchange(
  2. POST("/amazon/book/{title}", new Book("The Stand")),
  3. Book
  4. );

Sending a JSON body with a URI template

  1. val call = client.exchange(
  2. POST("/amazon/book/{title}", Book("The Stand")),
  3. Book::class.java
  4. )

In the above case the title property is included in the URI.