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
Flux<HttpResponse<Book>> call = Flux.from(client.exchange(
POST("/amazon/book/{title}", new Book("The Stand")),
Book.class
));
Sending a JSON body with a URI template
Flux<HttpResponse<Book>> call = client.exchange(
POST("/amazon/book/{title}", new Book("The Stand")),
Book
);
Sending a JSON body with a URI template
val call = client.exchange(
POST("/amazon/book/{title}", Book("The Stand")),
Book::class.java
)
In the above case the title
property is included in the URI.