Using the Giphy API Explorer we can run some test requests
to the Giphy API and explore what the data looks like.
Typically when we make requests to send and receive data on the web they use a data format called
JSON
(Javascript object notation). It’s exactly the same as the Javascript objects we’re used to
using:
{
"name": "Lawrence",
"age": 26,
"location": "Melbourne"
}
The only difference here? All keys (property names) and text values are wrapped inside of double
quotes. This makes it safer to send and receive the data over the web.
Say we do a search to give us back some doggo
gifs, we’ll get this back. Our response data from
Giphy is made up of three key bits:
{
"data": [],
"pagination": {},
"meta": {}
}
To expand on that a bit, the data we get back looks like:
{
"data": [
{
"type": "gif",
"id": "l2Sq0aDdjWbqgGsGQ",
"slug": "dogs-lookhuman-doggos-l2Sq0aDdjWbqgGsGQ",
"url": "https://giphy.com/gifs/dogs-lookhuman-doggos-l2Sq0aDdjWbqgGsGQ",
"images": {
"fixed_height_still": {
"url": "https://media0.giphy.com/media/l2Sq0aDdjWbqgGsGQ/200_s.gif",
"width": "200",
"height": "200"
}
},
"title": "dogs GIF by Look Human"
},
{
"type": "gif",
"id": "ConNgpWs8uriE",
"slug": "zebra-poodle-doggos-ConNgpWs8uriE",
"url": "https://giphy.com/gifs/zebra-poodle-doggos-ConNgpWs8uriE",
"images": {
"fixed_height_still": {
"url": "https://media3.giphy.com/media/ConNgpWs8uriE/200_s.gif",
"width": "161",
"height": "200",
"size": "20117"
}
},
"title": "zebra poodle GIF"
}
],
"pagination": {
"total_count": 391,
"count": 2,
"offset": 0
},
"meta": {
"status": 200,
"msg": "OK",
"response_id": "5a1fbcf64e456c6132d4bfa6"
}
}
With the requests we make, we are going to be interested in the data
part of the response.