Retrofit

Learn how to create effective REST clients on Android with Retrofit. Boost your productivity and enjoy working with complex APIs.

Buy on Leanpub.com

About the Retrofit Book


Due to the popularity of the Retrofit blog post series published in the Future Studio blog, we’ve decided to write a book on Retrofit. We keep a slightly techy style from the tutorials to make this book a great resource for every developer working with Retrofit.

We’ve updated, rewritten and extended all the content. There are much more descriptions, explanations and examples within the book. Furthermore, each chapter is structured to provide a common thread that guides you through all important aspects of Retrofit and your development experience.

You’ll receive extra sections that are only available within the book, like how to create your custom response converter,refresh outdated OAuth access tokens, release preparation using ProGuard.

What Topics Are Covered in This Book?

The list below provides a comprehensive overview of covered topics within the book.

  • Introduction to Retrofit
  • Quick Start Guide to jump right into Retrofit
  • Create a Sustainable Android REST Client
  • Extensive manipulation and customization of requests
  • Comprehensive overview of response converters and data mapping
  • Handling Authentication on Android (Basic, Token, OAuth, Hawk)
  • Advanced File Handling, like File Up- and Download
  • Detailed guide on Pagination
  • How to handle errors in your Android app
  • Debug requests and response using logging
  • Fundamentals to get going with mocking server responses
  • App release preparation including ProGuard configuration

Who Is This Book For?

In short: this book is for you. We believe that every developer reading this book will take away new ideas on how to optimize their Android apps in the sense of interacting with API’s or webservices using Retrofit. You’ll recognize goodies that are applicable for the projects you’re working on.

This book is for Android developers who want to receive a substantial overview and reference book on Retrofit. You’ll benefit from clearly recognizable code examples related to your daily work with Retrofit.

Rookie

If you’re just starting out with Retrofit (or coming from another HTTP library like Android Asynchronous Http Client or even Volley) this book will show you all important parts on how to create sustainable REST clients on Android. The provided code snippets let you jumpstart and create your first successful API client within minutes!

Expert

If you’ve already worked with Retrofit, you’ll profit from our extensive code snippets and apply the learnings to your existing code base. Additionally, the book illustrates various use cases for different functionalities and setups like authentication against different backends, request composition, file up- and downloads, etc.!

The Source Code Within

With the purchase of this book, you benefit from the sample project that awaits your download within the extras section on Leanpub. The sample project is an Android project based on gradle. You can directly touch and use classes that are only illustrated in excerpts within this book.

Check your Leanpub Library and select Retrofit: Love working with APIs on Android to download the sample code base.

Retrofit Book for Version 1.9

This is the second edition of the Retrofit book. It’s fully focused on Retrofit 2, no hint or code snippet that points to Retrofit 1. If you’re interested in the first version of the book that based on Retrofit 1, please visit this book’s extras page on Leanpub. As a reader of this book, the first version is — of course — also available for you!