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

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…

Contents