5. Putting it all together


` require "rest-client"
require "json"

events_url = "https://api.box.com/2.0/events"

response = RestClient.get(
:params => {:limit => 1},
:authorization => "Bearer " << "ACCESS_TOKEN"


Looking for help on this one. I'm new to API integrations and although I followed the directions, I'm receiving a 401 unauthorized error? Could it be that the Box URL is maybe outdated?


I had this same issue. Has anyone out there successfully completed this part?


Same thing has happened to me - Pretty sure that this is a glitch, and Codecademy just doesn't want to fix it.


Oh -- I changed

:authorization => "Bearer " << "ACCESS_TOKEN"


:authorization >> "Bearer " << "ACCESS_TOKEN"

and it worked. Even though it's a syntax error and the editor even says it, that's how it's supposed to be done apparently.


I noticed that "bearer " had a space in the string; I removed it and that solved the problem for me.


I noticed there was a lot of ways to get to the next lesson but you get errors:
- If you type the full oath_header = {: authorization it will work but get a lot of errors.
- If you remove the space get a 400 error but get the green arrow to next lesson.
- If you put replace => with >> you get a ruby error. and same green arrow.

This part of the lesson needs to be fixed.


This is the solution. remove that space.