Issue
i was trying to pass two parameters into the rest template execute method in the request GET body.
The API passes two parameter values
http://localhost:8080/api/likes/user?likes=xyz&user=abc
There are two entity class
public class Account{
public String user;
public String date;
public List<PostList> post;}
And PostList entity class
public class PostList{
public int likes;
public String comment;
public int shares;
}
I want to pass user from the Account class and Likes from Post_List class in the request get call
How could I wrap that in a class and pass the value?
Solution
Can have a method to create the url with updated query params. Keeping it simple, can look something like such:
private String createUrlForUserLikes(final Account account, final PostList postList) {
return String.format("http://localhost:8080/api/likes/user?likes=%s&user=%s", postList.likes(), account.user());
}
Answered By - Tim
Answer Checked By - Clifford M. (JavaFixing Volunteer)