Hey guys, As you know that fetching API is bread and butter for developers 😊. Here my best try to get and put data through Retrofit.
Before move further I give you short explanation that what is Retrofit actually!! Here We Go!!!
Retrofit is a REST Client for Java and Android. It makes it relatively easy to retrieve and upload JSON (or other structured data) via a REST based webservice. In Retrofit you configure which converter is used for the data serialization. Typically for JSON you use GSon, but you can add custom converters to process XML or other protocols. Retrofit uses the OkHttp library for HTTP requests.
To work with Retrofit you basically need the following three classes:
-
Model class which is used as a JSON model
-
Interfaces that define the possible HTTP operations
-
Retrofit.Builder class - Instance which uses the interface and the Builder API to allow defining the URL end point for the HTTP operations.
And then you follow my code enjoy your data with Retrofit