android studio retrofit post json code example

Example: 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);