Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools HTTP Basics Introduction to HTTP Sending Data with a GET Request

Dillon Reyna
Dillon Reyna
9,531 Points

What 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
Ari Misha
19,268 Points

Hiya 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

didn't the instructor say the get request doesn't have payload?

Technically, 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
Masha Blair
13,004 Points

That is a beautiful response, Ari! Thank you!

ywang04
ywang04
6,749 Points

Using 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.

but search? or maps? is a get request?