๐Ÿ‘๐Ÿ‘ Retrofit review ๐Ÿ‘๐Ÿ‘

Or how to use Kotlin + RxJava to get some cats

What is an API anyway?

It seems like everyone and their mother is running an API on the internets. If you are not too sure what an API is, or how to consume (????) it no less, fear not. This tutorial will teach you how you too can copy-paste your way to a lead dev position in Silicon Valley.

Cats are important

Doing something of value is paramount to finding happiness aside from browsing stale memes on r/programmerhumor.

What you will need

Just click File -> New project in Android Studio 3 and include Kotlin support, AndroidX artifacts and an empty activity pre-made. Press next on everything. Jetbrains really understands its market (monkeys banging the keyboard like me) and basically writes everything for you these days.

Dependencies

Go to the build.gradle (Module: app) file in the dependencies block. It should have these lines in it at least:

The cat whisperer

Thereโ€™s loads of public APIs out there to test out.

Setting things up like you know what you are doing

Get yourself a generic repository class like this one below.

Retro cat

Get your MainActivity and set up a button so you can test this request yourself.

Wew lad

Before you run this make sure to replace the apiKey variable with your own, personal, key.

Android dude @JustEatUK

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store