Using a URI Template
If some of the properties of the object need to be in the URI being posted to you can use a URI template.
For example imagine you have a class Book
that has a property called title
. You can represent the title
property in the URI template and then populate it from an instance of Book
. For example:
Sending a JSON body with a URI template
Flowable<HttpResponse<Book>> call = client.exchange(
POST("/amazon/book/{title}", new Book("The Stand")),
Book.class
);
Sending a JSON body with a URI template
Flowable<HttpResponse<Book>> call = client.exchange(
POST("/amazon/book/{title}", new Book("The Stand")),
Book.class
);
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 of the passed object will be included in the URI being posted to.