12/21/2023 0 Comments The embrace![]() A 200 code means the query was successful. We'll see that response in the bottom tab of Postman.Įvery API response comes with a response code. We intentionally put in a bogus API key here but we still get an informative response from the API. Once we're ready to make our API call, we click the Send button. The latter is a better idea because then we won't accidentally break the rest of the URL in the process. We can update the parameters (or add more) either in the URL itself or by changing/adding key value pairs in the Params tab. This is a very common format, though the names of the query parameters themselves will vary between APIs.Īs we can see, Postman makes it very easy to see our parameters, and also to update them if need be. Then finally, the parameters q and appid each parameter has a value and is separated by an & symbol: q=Portland&appid=xxxx.The format of this URL is exactly the same as the URL format of a webpage after we submit a form. The Params tab is open and the parameters of the API call are automatically populated if the URL includes any parameters. In the GIF above, we paste in the query we want. You will probably only be making GET requests during this section, but if you need to make a POST or other type of request, this is where you'd update the query to reflect that. The default type of API call is a GET request (the request type is just to the left of the URL bar). Next, we need to type in our query into the URL bar. In the following image these options are highlighted by a red circle. There's two ways to do this: you can open a new tab or select Create a request from the overview tab. To make an API call, we need to create a new request. While Postman has a lot of nice features, we'll only use the most basic ones here. To download the Postman app on your personal machine, go to the Postman downloads page, and select the correct download for your operating system.įinish your installation process and then open Postman. However, Postman is a much better tool for testing API calls and it includes many features that make testing APIs a more visual and inviting process. Technically, we could test all of our API calls in the browser. In this lesson, we'll learn how to use a tool called Postman to test our API calls. We learned some general pointers for walking through API documentation and we even made an API call in the browser. In the last lesson, we walked through the process of signing up for a developer account for the OpenWeather API and then getting an API key.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |