In addition to using replacement blocks to manipulate the target URL, Retrofit also allows you to add query parameters from method parameters defined with the @Query tag. The target URL will automatically be updated to include all of the parameters specified as if it was included in the URL directly.
- [Instructor] Right now the application…only loads a list of 30 gists from GitHub.…This is because by default…the GitHub API paginates the data,…meaning they break the larger list of data…into subsections or pages.…So how do we specify which page we want?…By using query parameters.…Let's go back to the project in Android Studio…to demonstrate how this is done.…In the IGitHub service interface…I have defined all of my API calls in,…let's take a look at the get public gists call.…
To get a specific page of gists from the GitHub API…we need to add a question mark to the end of the URL…and then the name of the parameter.…Page, in this case, followed by an equal sign,…and the value to use, like one, two, or three…for the page we want to load.…To use these in our methods in our project,…we need to include them as method parameters.…
To do this, start by adding a parameter like normal,…like an int called page num,…and then annotate the parameter with an at query tag.…In the parameters for the annotation,…we tell it what the query parameter…
- 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.