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 trialJonathan Grieve
Treehouse Moderator 91,253 PointsI have no clue. Make Request to follow users
I've been through the code I've built so far but I'm stumped. I'm out of my depth with this one. I've grabbed the URL from the documentation and I believe I've created a new instance from the api but I can only assume the variable for that is $api.
<?php
require 'authorization.php';
/*
* $api object provided
*/
$api = new "/user/following/:philsturgeon";
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Jonathan,
I can see you've got a bit lost on this one.
First off, you are correct in that the object is $api
. So, that will be used, but not as a variable name as you have it now. The variable name doesn't really matter, but it's good to use $response
. If you watch Alena set up a $response to get subscriptions here starting at the 20 second mark, the syntax for this challenge is pretty much exactly the same, except that the challenge will be a PUT request (not a GET) and the url string will be different, obviously. :)
The URL string you have is also correct, except for one thing. Lose the colon before the username. It should be "/user/following/philsturgeon"
.
With all this in mind, have a look at that little snippet of video and you should be able to get it. If you're still stuck, let me know.
Keep Coding!
Jonathan Grieve
Treehouse Moderator 91,253 PointsJonathan Grieve
Treehouse Moderator 91,253 PointsThanks Jason,
So in this case, in the Documentation the PUT refers to the request method to use and the colon is just saying, swap this part of the string with the username you want to target.
Thanks for your guidance. :) To be honest, this course is going into my "needs another go" category. And I'll probably do it in Workspaces as from the start, I couldn't replicate the styles or functionality on localhost! :)