Network Requests in Android using Retrofit — Beginners Guide
4 min readJun 6, 2023
In this article, you will learn how to make network requests using Retrofit, a popular type-safe HTTP client for Android.
Key terms
API: An Application Programming Interface is used to get data from a remote server, transfer data to a server, perform activities, and integrate various software systems.
Network Request: This is a message sent from one device to another over a network, typically using a standardized protocol such as HTTP or HTTPS. This can perform various actions such as GET, POST, PUT, and DELETE.
Explaining the response codes
Now let’s define all response codes that can be returned by a request.
- 200 OK: The request was successful, and the server has returned the requested content.
- 201 Created: The request was successful, and a new resource was created as a result.
- 204 No Content: The request was successful, but there is no content to send back in the response.
- 400 Bad Request: The server could not understand the request due to invalid syntax or other client-side errors.
- 401 Unauthorized: The requested resource requires authentication, and the client needs to provide valid…