What is rest, and what is its advantage

I have googled about rest documents, but I'm not quite sure I understand that.

What I see alone is that its URL is clean, for example:

http://host/webservice.asmx?name=xname&type=xtype 

If in REST style this is possible:

 http://host/webservice.asmx/xname/xtype 

Is not it?

So, I just found the URL cleaner, but I can not find any other benefits.

Can anyone tell me more?

I have a few more questions:

<h / "> <h /"> UPDATE:

I read this article (rest-to-my-wife), it seems that using the verbs provided by http (post / get / put / delete), we can perform another operation on the resource using the same URL Realized data in body http; For example, I want to create a new order:

 POST http://www.store.com/order, <purchase-order> <item> ... </item> </purchase-order> 

But I still have some questions:

1) how do we set the http body on the page?

Otherwise, I want to delete the order:

Delete http://www.store.com/order/1

But on the page, the URL is just a link,

Mabye looks like this:

delete this order

it is static, how can we tell the browser that when it sends this url to the server, it should use "delete" and not "receive"?

2) will this lead to additional work on the server side?

Since we can send the same URL with a different http (get / post ...) method to the server, so the server may have to parse the HTTP header and body to make sure the operation the user wants to do for that url (it might be better to use a "resource" instead of a "url", but I can't tell the difference between url and uri and resouce)?

Take the same URL, for example:

 http://www.store.com/order/1 

If the server detects that the http method "receives", it may know that "oh, this guy just wants to get order information whose identifier is 1", if the method is "delete", he knows "Oh, this guy wants to delete the order with identifier 1 ".

So, it seems that this method will transfer additional work from the client side to the server.

What I mean is that the client has the same URL, it’s easier, but the server side needs more work, is that true?

+4
source share
1 answer

HTTP itself is a REST implementation. The way the URL is built is irrelevant. REST is a method of transmitting information in every request, and not a permanent open connection.

+1
source

All Articles