retrofit post code example
Example 1: add retrofit dependency android
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
Example 2: android retrofit post json example
Follow these steps:
1.) Firstly create modal class (MyRequestClass) for your Post request from http://www.jsonschema2pojo.org/
2.) Also create modal (MyResponseClass) for your server response from same site.
3.) Set values you want to send to your server by creating object of MyRequestClass.
4.) Then hit api using this method in your interface:
@POST("/provider/filter")
Call<MyResponseClass> sendDataToServer(@Body MyRequestClass myModal);