Home > front end >  How to solve '@GET' not applicable to field Error while defining retrofit interface in and
How to solve '@GET' not applicable to field Error while defining retrofit interface in and

Time:04-29

I'm trying to pull a json data with a retrofit, but when using the @GET method, this error " '@GET' not applicable to field" pops up. What is the solution?

My Interface

    import com.google.gson.JsonElement;
    
    import java.util.List;
    import io.reactivex.Observable;
    
    import io.reactivex.Single;
    import retrofit2.Call;
    import retrofit2.http.GET;
    import retrofit2.http.Url;
    
    public interface IHealthAPI {
    
        //https://data.ibb.gov.tr/dataset/istanbul-saglik-kurum-ve-kuruluslari-verisi/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/view/e7f57e67-3f8f-4c82-987b-fef5d0c9099a
        //https://data.ibb.gov.tr/dataset/bd3b9489-c7d5-4ff3-897c-8667f57c70bb/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/download/salk-kurum-ve-kurulularna-ait-bilgiler.json

        @GET("/istanbul-saglik-kurum-ve-kuruluslari-verisi/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/view/e7f57e67-3f8f-4c82-987b-fef5d0c9099a")  //underlined in red and @GET' not applicable to field error occuring

        Call<List<ModelRetrofit>> getHealthInfos;
    }

CodePudding user response:

Your function definition is missing brackets

change

Call<List<ModelRetrofit>> getHealthInfos;

to

Call<List<ModelRetrofit>> getHealthInfos();
  • Related