I am using AsyncHttpClient for making HTTP calls. I am unable to find a solution to set a path parameter in a URL. Here is an example:
userId = "dmsask121"
String v3_USER_DETAILS = "http://example.com/users/{userId}/details";
Request request = new RequestBuilder(HttpConstants.Methods.GET)
.setUrl(v3_USER_DETAILS)
// some way to set userId in the URL??
.build();
return execute(request)
Thanks in advance for your help.
I checked out the library's code, and it looks like it doesn't support inserting path parameters into URLs. You can easily add a query parameter using addQueryParam(String name, String value)
, but there is no method to insert a path parameter as in your example. You have to prepare the whole path part another way, for example, using String::replace()
as suggested in a comment.