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 trialDillon Reyna
9,531 PointsWhat was the point of this?
What was the point of using a GET request to send data forward?
I understand how the following works
telnet httpbin.org 80
GET /get?food=sandwich&drink=water Host: httpbin.org
I just don't understand what this accomplishes, nor what use cases it could have.
2 Answers
Ari Misha
19,323 PointsHiya there! Understanding how HTTP works behind the scenes is everything. I mean consider HTTP a platform where all the important actions are taken. Lets just say you've an app and a resource name stock. It lives on remote servers. And a user visits your website and requests your server to get him/her a catalogue of everything thats stored in the stock. So whenever he'll interact with the website and make a request for the catalogue, a request is generated in form of GET request. Also this request will contain some information like what catalogue is user requesting. Its called Payload. You can actually read the request object in DevTools if you're curious. Now the server makes the request to the framework/back-end which routes it to controller and controller takes the request and get the appropriate information from the models and send it back to the server. Which in turn gets rendered (it could be a HTML or XML or jSON) and user recieves a response of 200 OK, which means everything went well and response was successful. This is one request-response cycle. It all happens in HTTP. Consider httpbin.org the resource and *food=sandwich&drink=water * the payload.
~ Ari
ywang04
6,762 PointsUsing get request to send data is often used in a web forum to search a website. You can simulate this in your browser by typing things like stackoverflow.com/search?q=http or google.com/maps?q=chicago.
It has been mentioned in this section.
Zhenghao He
Courses Plus Student 2,389 Pointsbut search? or maps? is a get request?
Zhenghao He
Courses Plus Student 2,389 PointsZhenghao He
Courses Plus Student 2,389 Pointsdidn't the instructor say the get request doesn't have payload?
Luis Marsano
21,425 PointsLuis Marsano
21,425 PointsTechnically, no payload is sent: the resource identifier (URI) is the 'payload'. The message requests the resource identified by the URI, which includes the entire query string.
Masha Blair
13,005 PointsMasha Blair
13,005 PointsThat is a beautiful response, Ari! Thank you!
JASON LEE
17,352 PointsJASON LEE
17,352 PointsI'm a bit confused on one part of Ari's response. I thought
httpbin.org
was the host, and the/get?
inGET /get?food=sandwich&drink=water
the resource