New Mail(Android API)

Unable to access API new mail.

I use Retrofit to work with the network.

This is how I form the interface:

@FormUrlEncoded
@POST("/v2.0/json")
Call<NovaPochtaSityModel> getSity(@Field("apiKey") String key, @Field("modelName") String modelName, @Field("calledMethod") String calledMethod);

Well, then I turn to the server:

Call<NovaPochtaSityModel> call = api.getSity("key","InternetDocument","getDocumentList");
    call.enqueue(new Callback<NovaPochtaSityModel>() {
        @Override
        public void onResponse(Call<NovaPochtaSityModel> call, Response<NovaPochtaSityModel> response) {
            Log.d("TAG", "Success");
        }

        @Override
        public void onFailure(Call<NovaPochtaSityModel> call, Throwable t) {
            Log.d("TAG", "Fail");
        }
    });

Well, actually initialization:

Gson gson = new GsonBuilder().create();
    Retrofit retrofit = new Retrofit.Builder()
            .client(getUnsafeOkHttpClient())
            .baseUrl("https://api.novaposhta.ua")
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build();
    API api = retrofit.create(API.class);

In response, I catch:

java.net.SocketTimeoutException: failed to connect to api.novaposhta.ua/185.128.233.69 (port 8883) after 10000ms

I increased the waiting time to 60 seconds, but it didn't help. And there is not so much data to pull them for more than a minute

UPD: enter a description of the image here

Author: Heaven, 2017-04-20

1 answers

Try to pull API through Postman this will help to check how correctly you specify the keys and headers. Sorry, I'm not good at android and java, I can't tell anything from your code, but in general, the timeout error is more of a server problem. In general, a strange port, have you tried changing it to 80 or 443?

Well, you got the error back. Most likely, it consists in the fact that you send data to the url, and you need to set raw in the body and form a jison in it according to the description in on the docks, add at least some thread heads and send it all to https://api.novaposhta.ua/v2.0/json

 3
Author: Igor Lavrynenko, 2017-09-04 07:26:54