I\'m using Retrofit to integrate my Web services and I do not understand how to send a JSON object to the server using a POST request. I\'m currently stuck, here is my code:
i think you should now create a service generator class and after that you should use Call to call your service
PostInterface postInterface = ServiceGenerator.createService(PostInterface.class);
Call responseCall =
postInterface.getStringScalar(requestBody);
then you can use this for synchronous request and get the body of response:
responseCall.execute().body();
and for asynchronous :
responseCall.enqueue(Callback);
refer to link provided below for complete walkthrough and how to create ServiceGenerator :
https://futurestud.io/tutorials/retrofit-getting-started-and-android-client