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 Introduction to REST APIs Getting the REST You Need Endpoints

Routine Poutine
Routine Poutine
26,038 Points

A URI does not identify the HTTP method, but the URL and URN; does this mean the REST API is beyond these?

GET = HTTP

URI = either URN or URL

/users = URN

http://teamtreehouse.com/users = URL


Does this make:

http://teamtreehouse.com/users="chalkers" = REST API?

or

="chalkers" = REST API?

1 Answer

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,861 Points

Hi Matthew,

You are confusing the access method and the http request method. The access method is the bit at the beginning of a URL that describes the protocol used for accessing the resource, like "http://", "https://", "ftp://", etc.

The http request method is the set of verbs that Alena was talking about: "GET", "POST", "PUT", "DELETE", etc.

When using a web browser, you generally don't see the http request method as it doesn't appear in your browser's address bar. But when it sends a request to a web server, the first line of the request (that the server receives from your browser) (aka the "Request Line") looks like this:

GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1

The first part of the request is the http request method. Here we're making a GET request: the typical request when browsing a web page.

Then after a space, is the URI for the resource being requested. In this case it is a full URL with the protocol (access method) but often you'll see just the part of the location after the domain name, and when that's the root page of the website, it's just a /:

GET / HTTP/1.1

The last part in the request line is the protocol version, in this case HTTP version 1.1.

Note that REST describes the API scheme, not a particular URL. That said, a particular URL may or may not conform to the site's REST API.

Hope that clears things up.

Cheers

Alex