HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

Retrofit Tutorial Part 3 - POST REQUEST & FORM URLENCODED - Android Studio Tutorial

130,150 views November 3, 2018 15:15

Watch on YouTube
ChannelCoding in Flow

Description from the creator

In part 3 of the Retrofit tutorial, we will learn how to make HTTP POST requests on a REST API to create new resources.
For this we use the @POST annotation in our interface, define the relative URL endpoint and pass the object that we want to send to the server as an argument that we annotate with @Body. The GSON converter will then serialize this object into the JSON format before it is uploaded to the server. If we want to serialize the object into another format (like XML or String), we can use a different ConverterFactory.
The same as in a GET request, the POST method returns a Call object that we can enqueue to execute it asynchronously. A successful POST request will return a 201 (Created) response code together with a response body in the onResponse callback.
Retrofit also supports form-urlencoded format (application/x-www-form-urlencoded). For this we have to annotate a POST method with @FormUrlEncoded and pass either single @Field arguments or a @FieldMap.

Watch the whole playlist:
youtube.com/playlist?list=PLrnPJCHvNZuCbuD3xpfK…

Example code for this part:
gist.github.com/codinginflow/88a7fffd9caeb7a192…

____________________
💻 Find the BEST programming tutorials on TutHub:
tuthub.io

⭐ Get my MVVM Caching Course now:
codinginflow.com/caching

❗ Subscribe to the channel:
youtube.com/c/codinginflo...

📨 Subscribe to the Coding in Flow newsletter:
codinginflow.com/newsletter

❓ Join our free developer community:
discord.gg/TSnMvmc

📣 Follow Coding in Flow on other sites:
Facebook: facebook.com/codinginflow
Instagram: instagram.com/codinginflow
TikTok: tiktok.com/@codinginflow
Twitter: twitter.com/codinginflow
Github: github.com/codinginflow

💰 Business requests, sponsoring, etc.: [email protected]

About this tutorial

Coding in Flow published this 15:15 video tutorial on November 3, 2018. It has been watched 130,150 times on YouTube.

Duration
15:15
Published
November 3, 2018
Views
130,150
Likes
1,739

Tags

Share

This tutorial in other languages