- Mastering ASP.NET Web API
- Mithun Pattankar Malendra Hurbuns
- 174字
- 2021-07-02 20:52:27
Level 2
Level 2 is for the use of HTTP verbs. So in level 1, we introduced resources, and level 2 introduces verbs.
Using the preceding example, when you post what you ate at 10 a.m., the server will give you back a resource. Using this resource, you can perform GET on that resource and see the details of what you ate at 10 a.m.:
GET: diet/ate/12789 Response { 'time':'10:00', 'apple':'1', 'water':'2' }
You can then update these details using PUT; note that we are acting on the same resource.
The request is as follows:
PUT: diet/ate/12789 { 'time':'10:00', 'tea':'1', 'muffin':'3' }
You can also delete this resource if you realize later on that you didn't eat at 10 a.m.:
DEL : diet/ate/12789
We used the same resource with a different verb.
When we created the resource in level 1, we changed POST to return 201 when the resource is created and a 409 conflict if the resource exists.
Part of level 2 uses response codes and does not return 200 for every operation.
- TypeScript入門與實戰
- 數字媒體應用教程
- Docker技術入門與實戰(第3版)
- PHP 從入門到項目實踐(超值版)
- 跟“龍哥”學C語言編程
- Mastering Spring MVC 4
- 64位匯編語言的編程藝術
- Object-Oriented JavaScript(Second Edition)
- Hands-On Automation Testing with Java for Beginners
- Kotlin從基礎到實戰
- Java程序設計入門
- Mastering Backbone.js
- Hands-On Nuxt.js Web Development
- Zabbix Performance Tuning
- C++從入門到精通(第6版)