12/31/2023 0 Comments Postman webAPI responses are typically just data, represented in a way that makes it easy to put to use. Web APIs can do a lot of the same things that a user can do through a web browser, but since they are intended to be used by computer programs, there is no need to specify how the data should be presented. Assuming we just wanted the list of search results for some other use and didn't want to deal with all of the other content, wouldn't it be nice to just get the data? The page includes instructions on what color and size the links should be, some JavaScript code that adds mouse-over effects, and so on. The response is so large not because of the size of the data itself, but all of the other information about how to display it that is included. If you consider how this page really just displays ten or so links and summaries, it seems inefficient to bury that information in such a mountain of markup, styles, and scripts. Due to the complexity and structure of the code (and how it is optimized for size), it would be difficult to do anything other than display this code in a web browser. Scroll around and take a look at how much code there is just to display this web page. You might look at this mess of HTML, CSS, and JavaScript and wonder how anything useful could be done with it. Click Send again to send this new request.Īssuming the response code is 200 OK, the response is the markup used to display a typical Google search result page. Let's put this knowledge to use by appending this path to to build the URL and adding a parameter with a search term. Instead of spending time on that, though, it's better to just tell you that the path for searches is /search and the query parameter that needs to be sent is q. ![]() If we were to dig into this HTML, eventually we would find the form and input elements, from which we could figure out how to build the query to perform a search. Luckily, we have computers and web browsers to do that for us. The HTML code of this page is heavily optimized to be as small as possible, and as a result, it is very difficult for a human to interpret it. You should see a screen that looks like this: Enter where it says Enter request URL here and press the Send button. Let's start with loading some web pages you are probably familiar with. ![]() We'll take advantage of these features throughout the course of this book, but we won't need most of them to make some simple requests. You can think of Postman as a specialized web browser that allows a little more manual control and has more buttons and switches as a result. It is fairly easy to make an HTTP request with postman.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |