FAQ: Requests I - XHR Post Requests III

This community-built FAQ covers the “XHR Post Requests III” exercise from the lesson “Requests I”.

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

Web Development

Introduction To JavaScript

FAQs on the exercise XHR Post Requests III

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!

I notice that in helperFunctions.js the function renderRawResponse checks for the value of res.errors and dispays an error message if it’s truthy. Where does the res.errors property come from?

OK, I self-helped.

The reason res.errors is available is because the response is JSON, which is an object, so I can access the value by specifying the key as a property of the object.

For example, if the response was…

{ name: "Terry Gilliam" }

…I could get "Terry Gilliam" via res.name.


Hello all, i put the url in and press shorten, but nothing shows, why? every step is green.

1 Like

I ran your code, and it works perfectly with my API key. If you haven’t replaced the value of apiKey with your actual key from rebrandly.com, you’ll need to do that. Don’t post it here. API keys are private. If you’ve already tried your code with a valid API key, post a reply, and I’ll have another look, but I don’t see any issues with your code. Good luck!

Thanks, may i know what should be shown on screen if it works? Thanks!

Hello i tried again still no show…

I think if you just remove the angle brackets < > from around your api key value, you’ll have it. Keep the quotation marks, but delete the brackets. :slightly_smiling_face:


what a stupid mistake! thank you so much!

and thanks for reminding me keeping api key secret, otherwise i would be spreading around the world :joy:

1 Like

How does the main,js access the renderResponse fuction in helperFuntion.js here as its not exported in this excercisei

If you look in the index.html file for the exercise, you see these two lines of code near the end of the file just inside the closing body tag:

  <script src="public/main.js"></script>
  <script src="public/helperFunctions.js">

Because both files are linked to the html file, the functions inside of helperFunctions.js are accessible to the functions in main.js.
Check out this thread: Code using function from another file without import / export


is there an alternative to rebrandly? The site doesn’t generate an API key for me - clicking the button does nothing and i’ve tried on several browsers.

Thank you! I had the same ‘problem’ today.

1 Like

I just followed this lesson today, and had the same issue. In my case, I had created my OWN const for the API key. However, there was already a const for the API key defined that said ‘’, or something along those lines. Make sure there aren’t two copies like I had, press “run code” again (this updates the output area), put in your URL, and try again.

This lesson is truly disappointing. I learned nothing. It’s just about copying stuff. Barely anything is explained. A lot of concepts are just thrown at you…