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 trialGremyko Coleman
9,756 PointsThe the URL for WikiURL no longer works, you cannot complete the exercise !!!
When you copy the wikiUrl link
https://en.wikipedia.org/api/rest_v1/page/summary/
directly into your browser. You receive an error message of
""type":"https://mediawiki.org/wiki/HyperSwitch/errors/not_found","title":"Not found.","method":"get","detail":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot GET /en.wikipedia.org/v1/page/summary/</pre>\n</body>\n</html>\n","uri":"/en.wikipedia.org/v1/page/summary/"}"
Which means we can no longer complete the excercise because, we are unable to get the astronauts summaries. Because the page with their summaries are no longer on the site.
Can someone at treehouse provide another url or find out where the original wikiURL has moved to. You cannot complete the exercise without this link working.
1 Answer
Rohald van Merode
Treehouse StaffHey Gremyko Coleman 👋
You've currently posted your question in the general JavaScript topic rather than associating it with the video your question is about. Because of this, I'm not entirely sure what video you're having an issue with. For this answer, I therefor assumed your question is about the Implement a Callback video. If this does not work for you please share a link to the video and I'll be happy to have another look 🙂
Based on that video you'll want to make sure that you concatenate the name of the astronaut to the end of the URL as Guil shows at the 3:10 mark. When trying to make a request to the URL without an endpoint, the API doesn't know what information you're requesting and you're indeed presented with a not found error.
After concatenating one of the astronaut names like: "Warren Hoburg" you will get the expected response as shown in the video: https://en.wikipedia.org/api/rest_v1/page/summary/Warren%20Hoburg
I hope this clears things up! 😄
Gremyko Coleman
9,756 PointsGremyko Coleman
9,756 PointsHey, Rohald,
Yes it is for the "implement a callback" video. But, I figured out the problem, the problem is within the Json data, that is returned from the astrosUrl. The data under the people.name's array portion of the data, the astronauts in space between their first and last name there is a space " " . But it should be a underscore instead "_" .
So, when you try to concatenate the names with the wikiUrl it doesn't work. Because of the issue with the spaces between the first and last names of the astronauts.
So, to fix it, I had called the .map on the returned jsonData from the astroUrl. To created another array, with that data to removed the spaces between astronauts first and last name. And replace the space with an underscore. By using the .replace method on the returned data from the astroUrl.
Then took that new array, and then concatenated the values of the astronauts in space with an "_" between their first and last name, and it worked.
The JsonData is currently return values like this a space between the first and last name
{craft: 'ISS', name: 'Sergey Prokopyev'} , {craft: 'ISS', name: 'Dmitry Petelin'} , {craft: 'ISS', name: 'Frank Rubio'}
The data needs to be like this to work with being concatenated in the wikiUrl no space between the first and last name only a "_"
{craft: 'ISS', name: 'Sergey Prokopyev'} , {craft: 'ISS', name: 'Dmitry_Petelin'} , {craft: 'ISS', name: 'Frank_Rubio'}
The code