Returns json data about all users.
-
URL
/user
-
Method:
GET -
URL Params
None
-
Data Params
None
-
Success Response:
- Code: 200
Content:[{ id : 1, name : "John", surname : "Doe", address : "Sth 23, CZ", employer : "Smith" }]
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ "0 records for users" }
- Code: 404 NOT FOUND
Returns json data about a user by id.
-
URL
/user/:id
-
Method:
GET -
URL Params
Required:
id=[integer] -
Data Params
None
-
Success Response:
- Code: 200
Content:{ id : 1, name : "John", surname : "Doe", address : "Sth 23, CZ", employer : "Smith" }
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ "0 records for users" }
- Code: 404 NOT FOUND
Returns id of created user.
-
URL
/user/
-
Method:
POST -
URL Params
none
-
Data Params
-
Required:
name=[string]
surname=[string] -
Optional
address=[string]
employer=[string]
-
-
Success Response:
- Code: 200
Content:{ <user_id> }
- Code: 200
-
Error Responses:
- Code: 406 NOT ACCEPTABLE
Content:{ "Name and surname must be filled" }
- Code: 406 NOT ACCEPTABLE
Returns json data with user id.
-
URL
/user/:id
-
Method:
PUT -
URL Params
Required:
id=[integer] -
Data Params
- Optional
name=[string]
surname=[string]
address=[string]
employer=[string]
- Optional
-
Success Response:
- Code: 200
Content:{ "User with id <id> was updated successfully" }
- Code: 200
-
Error Responses:
-
Code: 404 NOT FOUND
Content:{ "User with id <id> doesn't exist" } -
Code: 406 NOT ACCEPTABLE
Content:{ "Name can not be empty" } -
Code: 406 NOT ACCEPTABLE
Content:{ "Surname can not be empty" }
-
Returns json data with user id.
-
URL
/user/:id
-
Method:
DELETE -
URL Params
Required:
id=[integer] -
Data Params
none
-
Success Response:
- Code: 200
Content:{ "User with id <id> was deleted successfully" }
- Code: 200
-
Error Responses:
- Code: 404 NOT FOUND
Content:{ "User with id <id> doesn't exist" }
- Code: 404 NOT FOUND