FAQ: Requests II - fetch() POST Requests V

This community-built FAQ covers the “fetch() POST Requests V” exercise from the lesson “Requests II”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Introduction To JavaScript

FAQs on the exercise fetch() POST Requests V

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

.then(jsonResponse => {
renderResponse(jsonResponse);
} )
jsonResponse is passed in as a parameter but where is its value defined

1 Like

My friend, the jsonResponse value comes as the result of the previous promise.

I did all the steps and then i put in a url in the text field, and then clicked the shorten button on the webpage, but nothing happened.

9 Likes

Yes, I’m facing the same issue. Even with codecademy provided solution, on click of shorten button is not showing the result in responseField.

@midlindner Can you pls check this from your end?

I just went back to the exercise, and everything is working as expected.

We are on the same ‘end’. Moderators aren’t Codecademy staff. We just spend a lot of time voluntarily trying to be helpful on the forums. If you’d like to post your code, either myself or someone else may be able to help you out. You could try running your code with your browser console open to see if any error messages are displayed.

3 Likes

https://api.rebrandly.com/v1/links this link is the problem it says it’s not authorized that is why no POST request works, or at least that’s that my console says.

and thanks .

General question: I just wonder why we put “renderRawResponse(jsonResponse)” and then delete it after to put “renderResponse(jsonResponse)”? Is this to check if it works or maybe see the differences?

2 Likes

Make sure to put http in the url…

did this work for you ?. I placed http in url and it still doesn’t work for me.

hmmm worked for me
i dont know what is the main issue there

It might be to do with your API key, I had the same issue went over my code again and realised I hadn’t taken an angle bracket out, once I correctly inputted my API key it worked.

1 Like

did u put the url in the input form

So to well understand, is it the same purpose of the previous chapters with Request POST with the XHR JS object ?
If so why do we have to use one and not another ?

This is just a more modern syntax.
You can use either one of them, but it’s important to be familliar with both.

Personally, I prefer the new one.

1 Like

For people wondering why nothing is showing I’ve found that rebrandly needs about half an hour before your own generated API key works. So if you’ve completed every step and you’ve just set up your own API key, leave it for half an hour and try again and it should work.

Hello everyone, I was experiencing the same issue, after inputting a URL nothing appearing. Go back to where you entered your rebrandly api key in the code editor, and get rid of the <> tags around your apikey.

EQUESTS II

fetch() POST Requests V

so how are we able to use functions from helperFunctions.js in main.js without any imports and export statements?

The files are linked by the index.Html file. Both files are named using tags.

I have a question about the rendered the jsonResponse using the second .then().

I cannot seem to locate in the helperFunction.js where the function “renderResponse( jsonResponse)” parses the recieved JSON data into JavaScript for the shorturl to be obtained?

Or does it not need to be parsed?
main.js

helperFunction.js

Any help would be much appreciated. Cheers.