Retrofit is the one of the Best networking libarary in Android developed by Square. It is basically annotation based libarary for java and android internally used OkHttp client for network response. Retrofit needs any json factory provider to serialize and de-serialize object some common factory providers are: GSON-->Developed by google JACKSON
Note:On Android, callbacks will be executed on the main thread but Retrofit request will work on background thread
some common annotations mentioned below:
@GET-->For Get HTTP Request(For fetching the data from the server).
@POST-->For Post HTTP Request.(For Creating a new Resource in the server)
@PATCH-->For updating the Resource.(It will update only selected resources)
@PUT-->For updating the Resource(It will update whole resources).
@DELETE-->For Delete the Resource(It will delete selected resources).
@url-->for sending request to another url
Headers are used to specifiy extra information to the server for exmple token key or MIME
@Headers:used to pass the header in HTTP request
@Header:used when you pass the header on body
@HeaderMap:used when you pass the header on body with key,value pair.
@formUrlEncoded-->For sending the data to url
@MultiPart-->For sending files to the server.
@SerializedName-->When json field and pojo class variable is diffrent
@Expose-->To prevent a java class variable to serliazation/deserialization.
@Since-->for versioning of your Json classes.(Field will only be considered for Serialization/deserialization starting from certain version.Before that version, it will ignored.)
@Until-->for versioning of your Json classes.( field will only be considered for Serialization/deserialization until certain version. After that version, it will ignored.)
@JsonAdapter--> specifying the custom adapter we created above
call.cancel()-->To cancel the request call.execute()-->Run on Main Thread(snck) call.isCancel()-->check cancelling status call.enqueue()-->Run on Background thread(Asnk)