Programming

Understanding Retrofit in simple term!

retrofit library
Spread the love

Retrofit is a REST Client for Java and Android. REST is a client-server architecture. It is an acronym which denotes: Representational State Transfer.We use restful services to retrieve data from the server.  It relies on HTTP protocol. HTTP protocol tells the server what to do.
 
A RESTful Web Service on the other hand, which can also be called a REST API is based on representational state transfer architectural style and provides stateless operations for managing data using the structured web service annotations
 
 Common http requests include :
Get : get data from server 
POST/PUT : put new data in the server 
DELETE : delete data from the server 
 
retrofit
 
 
 After we made GET request, the server responses the request to the app including data and image url’s. The server response has formatted data. Common web formats are:
• XML
• JSON
 
In most cases it is formatted in json. Retrofit automatically serialises the JSON response using a POJO(Plain Old Java Object) which must be defined in advanced for the JSON Structure. To serialise JSON we need a converter to convert it into Gson first.
 
 

Leave a Reply

Your email address will not be published. Required fields are marked *