Search code examples
androidretrofit2http-status-code-500

Android. get "JSONObject[\"response\"] not found." when make request with retrofit


I get error when I try to make request with retrofit in my android application. I get 500 Interval Server Error

"title":"Internal Server Error","status":500,"detail":"JSONObject[\"response\"] not found.","path":"/api/profiles/help/45.13367991428822/33.5960291326046","message":"error.http.500"

Here is my code:

 IApiService service = RetrofitInstance.getRetrofitAuthInstance().create(IApiService.class);
        Call<ArrayList<Profile>> call = service.sendHelp(v1, v2);
        call.enqueue(new Callback<ArrayList<Profile>>() {
            @Override
            public void onResponse(Call<ArrayList<Profile>> call, Response<ArrayList<Profile>> response) {
                Toast.makeText(getBaseContext(), String.valueOf(response.code()), Toast.LENGTH_LONG).show();
            }

            @Override
            public void onFailure(Call<ArrayList<Profile>> call, Throwable t) {
                Toast.makeText(getBaseContext(), t.getMessage(), Toast.LENGTH_LONG).show();

            }
        });

And my Interface:

 @GET(Urls.SEND_HELP)
    Call<ArrayList<Profile>> sendHelp(@Path("latitude") String latitude,
                                      @Path("longitude") String longitude);

Please, help me.


Solution

  • Obviously problem is with object serialization on server side. Status code 5xx stands for error that happened on server. There is nothing you can do with your Retrofit client to fix it.