0

I am trying get from this address:

server-staging.co/api/v1

using OKHttp lib. After running the following code:

Uri.Builder builder = new Uri.Builder();
builder.scheme("http")
       .authority("server-staging.co/api/v1");

requestBuilder = new Request.Builder().url(new URL(builder.build().toString()));

Request request = requestBuilder.build();
Response response = mOkHttpClient.newCall(request)
                                         .execute();

I receive the following warning, which I've been unable to resolve.

java.net.UnknownHostException: Unable to resolve host "server-staging.co%2Fapi%2Fv1": No address associated with hostname

JY2k
  • 2,879
  • 1
  • 31
  • 60

1 Answers1

0

Do not add "api/v1" directly to the String, it is most like a parse URI
You might add these paths as in this answer URI appendPath

Community
  • 1
  • 1
UrielUVD
  • 482
  • 1
  • 9
  • 27