Now that everything is set up, define a method that you can use to GET a list of Gists from the GitHub API. Retrofit includes a collection of annotations that make this process simple and makes everything much easier to read.
- [Instructor] Open up the IGitHubService interface again…and let's define all of the methods we need to use…to get Gist data from the GitHub API.…All of these methods need to return a Retrofit…call object that wraps the type of data…that will contained in the response…and will need to be annotated with the correct Retrofit tag.…For instance, let's start with a method to get public Gists.…
This will be a method that returns a call…from the Retrofit 2 package, that wraps a list of Gists.…I'll call this method getPublicGists.…This will need to be annotated with the @GET tag…and then we need to define the URL relative to the base url…we specified when building an instance of our interface.…
The full URL is https://api.github.com/gists/public.…So in the @GET annotation, we will…include a string with /gists/public.…This method is now configured to call the URL…and then use the JSON converter factory to translate…the data return into a list of gists.…
Before we move on to using this,…let's define some of the other…get calls we need to make in the app.…
- REST API basics
- Methods for reading and writing data
- Defining data models with Retrofit
- Implementing an API interface
- Getting data with a Retrofit call
- Authorizing requests
- Putting, deleting, and posting data
- Customizing the data converter
- Working with the request and response headers
Skill Level Intermediate
Android App Development: Enterprise Integrationwith Jon-Luke West47m 51s Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
1. HTTP APIs
2. Get Started with Retrofit
3. Finish the Sample App
4. More Configuration Options
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.