rest

8
Before we get into $resource, can we talk about something else?

Upload: rap-payne

Post on 16-Apr-2017

162 views

Category:

Technology


0 download

TRANSCRIPT

Before we get into $resource, can we talk about something else?

Which url do you prefer?

This …

http://tic.com/Report.aspx?t=Sales&y=2015&m=03

… or this …

http://tic.com/Sales/2015/3

Why?

Reasons • SEO • Easy to type • Easy to remember • Hides implementation stack • URLs don’t have to change when the site changes. • Hackable

that reduces coupling

in a stateless environment …

an architectural style … REST is ...

HI, I'm Roy Fielding, the

inventor of REST.

for addressing resources …

A RESTful URL is one that conforms to all of the constraints

Separation between client and server Stateless communication

Cacheable A layered system

A uniform interface

A layered system has predictable parts

Properly RESTful url has ...

Category

Thing

ID

Use HTTP methods to specify the action

GET POST PUT

DELETE

The URL should act as an API • GET http://tic.com/Customer• POST http://tic.com/Customer• GET http://tic.com/Customer/71• PUT http://tic.com/Customer/71• DELETE http://tic.com/Customer/71• GET http://tic.com/Department• GET http://tic.com/Employee• POST http://tic.com/AddToCart/17