@@ -6,6 +6,10 @@ _url: [`https://websuck1t.herokuapp.com`](https://websuck1t.herokuapp.com)_
66
77## GET /posts/all
88
9+_start with: [`https://websuck1t.herokuapp.com/posts/all`](https://websuck1t.herokuapp.com/posts/all)_
10+
11+Use this _url_ to get the token every time when application begins and previous session was closed
12+
913### Response:
1014
1115- Status code 200
@@ -55,82 +59,19 @@ _url: [`https://websuck1t.herokuapp.com`](https://websuck1t.herokuapp.com)_
5559}
5660```
5761
58−## GET /users/:id
59−
60−Retrieves a user with the given `id`.
61−
62−#### If there is no user with the given `id`, the method returns error `404`.
63−
64−### Captures:
65−
66−- *id*: The id of the entity you want to query.
62+### Response fields
6763
68−### Response:
69−
70−- Status code 200
71−- Headers: []
72−
73−- Supported content types are:
74−
75− - `application/json`
76−
77−- Example (`application/json`):
78−
79−```javascript
80−{
81− "userName": {
82− "secondName": "Leonidovich",
83− "firstName": "Seva"
84− },
85− "userId": 1
86−}
87−```
88−
89−- Example (`application/json`):
90−
91−```javascript
92−{
93− "userName": {
94− "secondName": "Barovich",
95− "firstName": "Foo"
96− },
97− "userId": 42
98−}
99−```
100−
101−- Example (`application/json`):
102−
103−```javascript
104−{
105− "userName": {
106− "secondName": "Fooovich",
107− "firstName": "Bar"
108− },
109− "userId": 69
110−}
111−```
112−
113−- Example (`application/json`):
114−
115−```javascript
116−{
117− "userName": {
118− "secondName": "Quixovich",
119− "firstName": "Qux"
120− },
121− "userId": 8
122−}
123−```
64+- "token" to further use it in subscription to web socket
65+- "response" to start with the given number of posts in table
12466
12567## WebSocket /posts/subscribe/:token
12668
12769You access the web socket with the web socket protocol. I. e. `https://` -> `ws://`.
12870
129−Open a web socket from the given `token` for receiving events about new and deleted posts.
71+Open a web socket from the given `token` for receiving events about new and deleted posts with `ws://websuck1t.herokuapp.com/posts/subscribe/{token}`
13072
13173#### Returns error `498` if the supplied token has expired or is invalid.
13274
133−
13475### Captures:
13576
13677- *token*: The token, received with the previous request.
@@ -157,6 +98,8 @@ Open a web socket from the given `token` for receiving events about new and dele
15798
15899## GET /posts/:id
159100
101+_url: [`https://websuck1t.herokuapp.com/posts/{id}`](https://websuck1t.herokuapp.com/posts/1)_
102+
160103#### If there is no post with the given `id`, the method returns error `404`.
161104
162105### Captures:
@@ -221,3 +164,73 @@ Open a web socket from the given `token` for receiving events about new and dele
221164 "postId": 1
222165}
223166```
167+
168+
169+## GET /users/:id
170+
171+_url: [`https://websuck1t.herokuapp.com/users/{id}`](https://websuck1t.herokuapp.com/users/1)_
172+
173+Retrieves a user with the given `id`.
174+
175+#### If there is no user with the given `id`, the method returns error `404`.
176+
177+### Captures:
178+
179+- *id*: The id of the entity you want to query.
180+
181+### Response:
182+
183+- Status code 200
184+- Headers: []
185+
186+- Supported content types are:
187+
188+ - `application/json`
189+
190+- Example (`application/json`):
191+
192+```javascript
193+{
194+ "userName": {
195+ "secondName": "Leonidovich",
196+ "firstName": "Seva"
197+ },
198+ "userId": 1
199+}
200+```
201+
202+- Example (`application/json`):
203+
204+```javascript
205+{
206+ "userName": {
207+ "secondName": "Barovich",
208+ "firstName": "Foo"
209+ },
210+ "userId": 42
211+}
212+```
213+
214+- Example (`application/json`):
215+
216+```javascript
217+{
218+ "userName": {
219+ "secondName": "Fooovich",
220+ "firstName": "Bar"
221+ },
222+ "userId": 69
223+}
224+```
225+
226+- Example (`application/json`):
227+
228+```javascript
229+{
230+ "userName": {
231+ "secondName": "Quixovich",
232+ "firstName": "Qux"
233+ },
234+ "userId": 8
235+}
236+```