Request methods: GET, POST etc.

What HTTP request methods are available in Retrofit and how to use them

For a more complete and in-depth explanation, check out our complete Retrofit course

Download the starter project here

Github repository

Here is a list of all the available methods








Normally you would use just a subset of these. These correspond directly to regular HTTP methods that you might be used to.

GET and POST are the most common types of requests that are used to simply send a request for some information. You might get back a web page or a JSON reply.

The PUT method allow us to put a resource on a server

DELETE is the opposite, it removes a resource from a server

OPTIONS retrieves the methods that are available on a server

HEAD only returns the headers that would be returned if you would do a GET request

PATCH allows us o modify a resource on a server in some way.

Usually when you’re communicating with an API you have an API definition that will tell you which methods to use for which resources. So you might not need to use some methods like OPTIONS or HEAD because you would already know what the API does in detail.

So let’s practice implementing the POST method to see the differences with the GET method that we’ve already implemented in previous videos.

The GET method allows us to send parameters in the URL itself, whereas the POST method allows us to send the parameters in the body of the request.

We will learn more about this when we discuss the query parameters, so we will learn how to put parameters in the query. For now, we will perform two requests, one that is a GET and one that is a POST.

In the ApiCall interface create your POST request


fun callPost(): Call<ApiCallResponse>

Update the Service class to call the newly created function instead of callGet

fun call() = api.callPost()

post method

For a more complete and in-depth explanation, check out our complete Retrofit course

Close Bitnami banner