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 trial

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,323 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,005 Points

That is a beautiful response, Ari! Thank you!

I'm a bit confused on one part of Ari's response. I thought httpbin.org was the host, and the /get? in GET /get?food=sandwich&drink=water the resource

6,762 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?