Skip to content Skip to sidebar Skip to footer

Capturing List Response For A Retrofit Call With Json Body

All. I am trying to use Retrofit to send raw json as a body in a POST Request to the server. @POST('api/apps') Call> getApp(@Body GetApps body); I have

Solution 1:

You must pass GetApps object as parameter:

GetAppsgetApps=newGetApps();
//set all your data on getApps//getApps.setYourData(yourData);
Call<List<GetApps>> call = apiService.getApp(getApps);

Solution 2:

You make request

@POST("api/apps")
Call<List<GetApps>> getApp(@Body GetApps body);

which will accept body that will append to URL.

just add body in getApp(@Body GetApps body); // accept JSON string as a parameter.

Happy coding!!

Solution 3:

At the top of Post just add @FormEncodedUrl and pass a GetApp model as body ... Call<List<GetApps>> call = apiservice.getApp(getAppOne);

Post a Comment for "Capturing List Response For A Retrofit Call With Json Body"