@@ -14,7 +14,7 @@ This document covers the best practices on designing a RESTful API (with the exc
14
14
15
15
## Practices
16
16
17
- 1 . Use HTTP-verbs to denote actions:
17
+ ### Use HTTP-verbs to denote actions:
18
18
19
19
` GET ` - read/retrieve a resource
20
20
` POST ` - create a new resource
@@ -40,7 +40,7 @@ POST /cars/1234/delete
40
40
```
41
41
42
42
43
- 1 . Use nouns, not verbs
43
+ ### Use nouns, not verbs
44
44
45
45
Good:
46
46
```
53
53
```
54
54
55
55
56
- 1 . Use ** plural** nouns (and do not mix with singular)
56
+ ### Use ** plural** nouns (and do not mix with singular)
57
57
58
58
Good:
59
59
```
69
69
70
70
71
71
72
- 1 . GET method should be idempotent (should not change state)
72
+ ### GET method should be idempotent (should not change state)
73
73
74
74
Good:
75
75
```
@@ -85,7 +85,8 @@ GET /orders/1234/activate
85
85
86
86
87
87
88
- 1 . Make a version ** mandatory** . ** NEVER** release unversioned api for public usage. Avoid dot-notation:
88
+ ### Make a version ** mandatory** .
89
+ ** NEVER** release unversioned api for public usage. Avoid dot-notation:
89
90
90
91
GOOD:
91
92
```
100
101
101
102
102
103
103
- 1 . Use HTTP status codes for errors:
104
+ ### Use HTTP status codes for errors:
104
105
105
106
| Code | Status | Meaning |
106
107
| ---- | ------ | ------- |
117
118
118
119
119
120
120
- 1 . Use JSON-wrapper for any kind of return messages:
121
+ ### Use JSON-wrapper for any kind of return messages:
121
122
122
123
Good:
123
124
```
@@ -140,7 +141,7 @@ Good:
140
141
141
142
142
143
143
- 1 . Use parameters for filtering/sorting/limiting. Delimit the * multivalue* parameters with comma.
144
+ ### Use parameters for filtering/sorting/limiting. Delimit the * multivalue* parameters with comma.
144
145
145
146
Good:
146
147
```
156
157
```
157
158
158
159
159
- 1 . Use subresources to denote relations. Do not make deep nesting:
160
+ ### Use subresources to denote relations. Do not make deep nesting:
160
161
161
162
Good:
162
163
```
173
174
174
175
175
176
176
- 1 . It is a good idea to have different formats for endpoint responses:
177
+ ### It is a good idea to have different formats for endpoint responses:
177
178
1 . JSON ` /orders `
178
179
2 . XML ` /orders.xml `
179
180
3 . JSONP ` /orders?callback=jsonp_callback `
@@ -186,4 +187,4 @@ This guidelines is based on these resources:
186
187
1 . https://github.com/WhiteHouse/api-standards
187
188
1 . http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api
188
189
1 . http://blog.mwaysolutions.com/2014/06/05/10-best-practices-for-better-restful-api/
189
- 1 . http://www.slideshare.net/mario_cardinal/best-practices-for-designing-pragmatic-restful-api
190
+ 1 . http://www.slideshare.net/mario_cardinal/best-practices-for-designing-pragmatic-restful-api
0 commit comments