‫Welcome back.
‫Till now, we succeeded in creating our own API and transforming and converting the database data and
‫records into Json response.
‫Now let's move to the next step which is retrofit.
‫And since we're going to follow the mVVM architecture in this application, I'll start from the section
‫which is removed.
‫Data source and retrofit configurations in Android.
‫Development.
‫Retrofit is a popular library for making network requests to a Rest API representational State Transfer
‫Application programming interface.
‫It simplifies the process of sending and receiving data from a web service.
‫When working with retrofit, you'll often come across concepts like data classes, retrofit instances,
‫and API service interface.
‫Let's start with the data classes or Pojo.
‫Plain old Java objects.
‫When working with retrofit data, classes are commonly used to represent the structure of the data you
‫expect to send or receive from a web service.
‫You would use data classes or modal classes to represent the structure of the data you want to send
‫as the request body, or the data you expect to receive as the response from the API.
‫As mentioned in the previous section, we can use online tools to transform our Json response into Pojo
‫classes, or we can do it manually.
‫The second part, or the second step is to create the API service interface.
‫In retrofit, an API or service interface is a simple interface that defines the endpoints Http methods
‫like get, post, put, delete, and the structure of the network requests to a rest API.
‫Each method in the interface represents a specific API endpoint, and retrofit will generate the necessary
‫code to handle the network request and response processing.
‫The third part is the retrofit instance.
‫A retrofit instance is the entry point to using the retrofit library.
‫It's responsible for configuring the settings that apply to all your network requests, such as the
‫base URL of the API, converters for parsing responses, and Http client settings.
‫These are the parts of retrofit.
‫Now let's start with the data classes, then move to the service interface and the retrofit instance.