Slide 1

Slide 1 text

@ValentineRutto, Android Engineer Consuming Rest APIs in Android

Slide 2

Slide 2 text

ValentineRutto Android Engineer-@Dlight Twitter | Linkedin | Medium | Github | Instagram @valentinerutto

Slide 3

Slide 3 text

API(application programming interface). It is a set of rules that allow programs to talk to each other. REST(“Representational State Transfer”) -Determines how the API looks like -It is a set of rules that developers follow when they create their API What is Rest API?

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

A client library developed by square that is used to create HTTP Requests and process HTTP responses from a REST API Retrofit library

Slide 6

Slide 6 text

● Retrofit Interface An interface that defines HTTP operations @GET("api/breeds/image/random") suspend fun getRandomDogImage(): DogImageResponse ● Retrofit class Creates an instance of retrofit and implements the retrofit interface methods val apiClient: ApiService= Retrofit.Builder() .baseUrl("https://dog.ceo") .client(OkHttpClient()) .addConverterFactory(GsonConverterFactory.create()) .build() .create(ApiService::class.java) ● Retrofit Converters Defines format that data will be represented in. GSON is JSON mapping. Retrofit Classes

Slide 7

Slide 7 text

Resources DOGAPI Documentation Consuming dog api

Slide 8

Slide 8 text

Demo Github Code https://github.com/valentineRutto/RandomdogImages

Slide 9

Slide 9 text

Thank You Twitter | Linkedin | Medium | Github @valentinerutto