Retrofit Basics

For Retrofit beginners: get your feet wet and execute your first requests

In this learning path you’ll learn how to setup your first Retrofit request, how to interact with an API, how to convert XML and JSON payloads, various parameters and more. If you’re new to Retrofit, this is the learning path for you!

Curriculum

 

Create Retrofit Client

  • In this first part, you’ll learn how to set up your Retrofit client as the base for executing requests.
  • 01

    Learn the basics of Retrofit and create your first Android client for API or HTTP requests. You’ll get an overview over Retrofit, add necessary dependencies to your build, and implement a demo request to the GitHub API.

  • 02

    Learn in detail how to describe all kinds of API endpoints in Retrofit.

  • 03

    Get to know our implementation of a clean, stable and sustainable Android client: the ServiceGenerator.

Sending Your First Request

  • In this part you’ll use the Retrofit client to execute your first requests.
  • 04

    Learn how to perform the actual requests in either way: synchronous or asynchronous. We’ll also show you the implications of using the synchronous requests on Android.

  • 05

    Retrofit handles the relationship between API base URL and request endpoint URL in a logical manner. You’ll learn in detail how Retrofit assembles complete URLs.

  • 06

    Learn how to define and send Java objects in an HTTP request body with Retrofit.

Payload Conversion

  • In this part you’ll learn how to convert request and response payloads with Retrofit.
  • 07

    Get to know all provided standard converters and how to use them for mapping from and to various standard formats.

  • 08

    Learn how to integrate and customize the Gson converter to map all of your JSON request and responses automatically.

  • 09

    Still using XML for REST? Learn how to integrate an XML converter to map HTTP responses from XML to Java (and vice versa).

Developer Utilities

  • In this part you’ll learn how to analyze Retrofit’s behavior.
  • 10

    You want to know what exactly Retrofit is receiving and sending to your server? Learn how to add a logging interceptor to your Android app.

Request Manipulation & Files

  • In this final part you’ll learn a variety of request manipulations, including sending files.
  • 11

    Learn how to use Retrofit to add (optional) query parameters to your requests.

  • 12

    Learn how to use (optional) path parameters to refine your request for single or multiple values.

  • 13

    Does your API require you to send the same header on every request? Do you want to fine tune caching? Learn how how to add custom headers to your requests.

  • 14

    Learn how to annotate your service interface to execute form urlencoded requests using Retrofit.

  • 15

    Does your app allow photo or video upload? Learn how to upload files to a server using Retrofit.

  • 🎯