Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Fetching Data with the Fetch API

Fix for outdated Trending GIFs Endpoint. Hope this helps people!!

Noticed the endpoint used in this video was no longer working and wouldn't return an array of gifs in JSON. Here was my Fix:

To get a working endpoint we need an api key. To do this go onto giphy's developer website https://developers.giphy.com/docs/sdk and make a free account.

After you've made an account hit the create an app button on their website, tell them a little about your project and you will be given an API Key. (Its very quick don't worry)

Now put that API key into your fetch command and you should be good!

E.X. of my code without my API Key for obvious reasons

componentDidMount() { fetch('https://api.giphy.com/v1/gifs/trending?api_key=enter your api key here &limit=25&rating=G')

Also you can use https://developers.giphy.com/explorer/ to help you get the correct format for more requests

Thank you Blake !

thanks Blake for saving us the trouble!

Thank you, Blake! Appreciated it!

Ayyyyy LFG! Still works in 2022. Thank you, Blake!

1 Answer

Thanks a lot mate