0PricingLogin
Jetpack Compose Academy · Lesson

Define a Retrofit API Interface

Declare endpoints with annotations.

What Retrofit Does

Retrofit turns a plain Kotlin interface into a working HTTP client, so you describe your API and it writes the networking code for you.

It Starts With an Interface

You declare each endpoint as a function inside a Kotlin interface. Retrofit reads the annotations and builds the real implementation at runtime.

interface UserApi {
    // endpoint functions go here
}

All lessons in this course

  1. Define a Retrofit API Interface
  2. Parsing JSON with Moshi
  3. suspend Calls in the ViewModel
  4. Loading, Success & Error UI
← Back to Jetpack Compose Academy