From the course: Android Development: Retrofit with Java

REST APIs - Android Tutorial

From the course: Android Development: Retrofit with Java

Start my 1-month free trial

REST APIs

- [Instructor] What is the Retrofit API? - [Instructor] What is the Retrofit API? - [Instructor] What is the Retrofit API? As the website puts it, As the website puts it, As the website puts it, it is a type-safe HTTP client for Android and Java. it is a type-safe HTTP client for Android and Java. it is a type-safe HTTP client for Android and Java. But what does that mean? But what does that mean? But what does that mean? To understand exactly what Retrofit is To understand exactly what Retrofit is To understand exactly what Retrofit is and why we would want to use it in a Android application, and why we would want to use it in a Android application, and why we would want to use it in a Android application, we need to know a little bit about how devices we need to know a little bit about how devices we need to know a little bit about how devices on the internet communicate with one another. on the internet communicate with one another. on the internet communicate with one another. For the most part, they use a set of rules For the most part, they use a set of rules For the most part, they use a set of rules to determine how data should be shared to determine how data should be shared to determine how data should be shared called communication protocols. called communication protocols. called communication protocols. Primarily the Internet Protocol Suite, Primarily the Internet Protocol Suite, Primarily the Internet Protocol Suite, which is a set of communications protocols which is a set of communications protocols which is a set of communications protocols that specifies how data should be packaged, that specifies how data should be packaged, that specifies how data should be packaged, addressed, routed, and received. addressed, routed, and received. addressed, routed, and received. This suite of protocols is commonly referred to This suite of protocols is commonly referred to This suite of protocols is commonly referred to as the TCP/IP model, as the TCP/IP model, as the TCP/IP model, but please keep in mind that TCP and IP but please keep in mind that TCP and IP but please keep in mind that TCP and IP are two specific protocols within this suite. are two specific protocols within this suite. are two specific protocols within this suite. HTTP and HTTPS are two other protocols within that suite HTTP and HTTPS are two other protocols within that suite HTTP and HTTPS are two other protocols within that suite that you are probably familiar with among many others. that you are probably familiar with among many others. that you are probably familiar with among many others. These stand for Hypertext Transfer Protocol These stand for Hypertext Transfer Protocol These stand for Hypertext Transfer Protocol and Hypertext Transfer Protocol Secure. and Hypertext Transfer Protocol Secure. and Hypertext Transfer Protocol Secure. Using these protocols, computers communicate Using these protocols, computers communicate Using these protocols, computers communicate with one another through a defined message structure. with one another through a defined message structure. with one another through a defined message structure. This is defined as the HTTP 1.1 standard, This is defined as the HTTP 1.1 standard, This is defined as the HTTP 1.1 standard, which is detailed in a publication which is detailed in a publication which is detailed in a publication by the Internet Engineering Task Force or the IETF by the Internet Engineering Task Force or the IETF by the Internet Engineering Task Force or the IETF called an RFC 7230, which you can read called an RFC 7230, which you can read called an RFC 7230, which you can read all about here if you feel up for it. all about here if you feel up for it. all about here if you feel up for it. There has been one major revision in this standard, There has been one major revision in this standard, There has been one major revision in this standard, HTTP/2, which was published in 2015, HTTP/2, which was published in 2015, HTTP/2, which was published in 2015, but it was designed to optimize data transmission but it was designed to optimize data transmission but it was designed to optimize data transmission and does not change the syntax defined in 1.1. and does not change the syntax defined in 1.1. and does not change the syntax defined in 1.1. When you are browsing the web, you may have noticed When you are browsing the web, you may have noticed When you are browsing the web, you may have noticed that the website URLs usually start with http or https. that the website URLs usually start with http or https. that the website URLs usually start with http or https. This is because these are the protocols being used This is because these are the protocols being used This is because these are the protocols being used by those websites, the server, and your browser, by those websites, the server, and your browser, by those websites, the server, and your browser, Chrome, Firefox, or Edge for example, which is the client, Chrome, Firefox, or Edge for example, which is the client, Chrome, Firefox, or Edge for example, which is the client, to communicate with one another and display the page to communicate with one another and display the page to communicate with one another and display the page and everything it contains. and everything it contains. and everything it contains. The content isn't always visual though. The content isn't always visual though. The content isn't always visual though. Sometimes it is just data Sometimes it is just data Sometimes it is just data in any number of different formats. in any number of different formats. in any number of different formats. These are web services. These are web services. These are web services. REST is a common architecture style REST is a common architecture style REST is a common architecture style that is used by some web services that is used by some web services that is used by some web services along with the HTTP and HTTPS protocols. along with the HTTP and HTTPS protocols. along with the HTTP and HTTPS protocols. REST stands for Representational State Transfer, REST stands for Representational State Transfer, REST stands for Representational State Transfer, and is a set of rules used when creating a web service and is a set of rules used when creating a web service and is a set of rules used when creating a web service that utilizes a set of standardized methods that utilizes a set of standardized methods that utilizes a set of standardized methods for communicating called HTTP methods. for communicating called HTTP methods. for communicating called HTTP methods. Web services that conform to these set of rules Web services that conform to these set of rules Web services that conform to these set of rules are called RESTful APIs. are called RESTful APIs. are called RESTful APIs. So let's return to our original question. So let's return to our original question. So let's return to our original question. What is the Retrofit API? What is the Retrofit API? What is the Retrofit API? It is a Java API that makes communicating It is a Java API that makes communicating It is a Java API that makes communicating with a RESTful API simple by enabling you with a RESTful API simple by enabling you with a RESTful API simple by enabling you to convert the RESTful API's HTTP methods to convert the RESTful API's HTTP methods to convert the RESTful API's HTTP methods into methods you can execute in your application's code. into methods you can execute in your application's code. into methods you can execute in your application's code. It means this request can be made It means this request can be made It means this request can be made by writing a line of code that looks like this. by writing a line of code that looks like this. by writing a line of code that looks like this.

Contents