From the course: Introduction to Web APIs
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Access data in the response - REST Tutorial
From the course: Introduction to Web APIs
Access data in the response
- There's a lot of information contained in the response, and we want to be able to access specific parts of it. There's one specific property we're going to use for our purposes. We want to display a gif image on our webpage. There are multiple image sizes and types available for this one gif. We're going to use the original size and get the URL for that image. I chose this because getting a URL will work really well for ultimately displaying the data in html and on a webpage. It's also great to show how .notation is used to work with objects. So let's look at the response in the browser. The first object we go into is the data object. Then we want to go into the images object. Within the images object, we want to go into the original object. And then, within the original object, the property that we want is the URL property. So we'll use .notation to get down into this property. So let's go into our code and we'll do…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Authentication with an API key4m 42s
-
(Locked)
Make a request to the Giphy API4m 13s
-
(Locked)
Filter response with parameters2m 9s
-
(Locked)
Access data in the response2m 2s
-
(Locked)
Use the response data in HTML1m 15s
-
(Locked)
Challenge: Explore the Giphy API1m 24s
-
(Locked)
Solution: Explore the Giphy API1m 50s
-
(Locked)
-
-
-