For some unknown reason, I do not receive data from the server
public interface API { @FormUrlEncoded @POST("/api/index.php") Call<String> getId(@Field("enter") String s);} I want to send a Post request to the address
https: // developerteam.ml // api / index.php
with the string value enter (key) s (value)
ID should come back
private Gson gson = new GsonBuilder().create(); private Retrofit retrofit = new Retrofit.Builder() .addConverterFactory(GsonConverterFactory.create(gson)) .baseUrl("https://developerteam.ml") .build(); private API api = retrofit.create(API.class); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Call<String> call = api.getId("1"); call.enqueue(new Callback<String>() { @Override public void onResponse(Call<String> call, Response<String> response) { ID = gson.toJson(response.body().toString()); } @Override public void onFailure(Call<String> call, Throwable t) { } }); Content response.body:
{serializeNulls: falsefactories: [Factory [typeHierarchy = com.google.gson.JsonElement, adapter = com.google.gson.internal.bind.TypeAdapters $ 25 @ ec799a3], com.google.gson.internal.bind.ObjectTypeAdapter$1@2de44a0 , com.google.gson.internal.Excluder@54c2859, Factory [type = java.lang.String, adapter = com.google.gson.internal.bind.TypeAdapters $ 13 @ 38e7c1e], Factory [type = java.lang.Integer + int, adapter = com.google.gson.internal.bind.TypeAdapters $ 7 @ ab02cff], Factory [type = java.lang.Boolean + boolean, adapter = com.google.gson.internal.bind.TypeAdapters $ 3 @ 6f30acc] .....

