curl "http://0.0.0.0:8091/info"
Result: info about app should be in response
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BLACK",
"bear_name": "mikhail",
"bear_age": 17.5
}'
Result: bear is created
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_name": "mikhail",
"bear_age": 17.5
}'
Result: Error. Pls fill all parameters
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BLACK",
"bear_age": 17.5
}'
Result: Error. Pls fill all parameters
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BLACK",
"bear_name": "mikhail"
}'
Result: Error. Pls fill all parameters
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{}'
Result: Error. Pls fill all parameters
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "1",
"bear_name": "mikhail",
"bear_age": 17.5
}'
Result: bear could not be created
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BLACK",
"bear_name": "1111",
"bear_age": 17.5
}'
Result: bear could not be created. Name should be alphabetical
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: text/plain; charset=utf-8' \
-d $'{
"bear_type": "BLACK",
"bear_name": "Mike",
"bear_age": "f"
}'
Result: bear could not be created. Age should be numerical
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "POLAR",
"bear_name": "mikhail",
"bear_age": 17.5
}'
Result: bear is created
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BROWN",
"bear_name": "mikhail",
"bear_age": 17.5
}'
Result: bear is created
curl -X "POST" "http://0.0.0.0:8091/bear" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "GUMMY",
"bear_name": "mikhail",
"bear_age": 17.5
}'
Result: bear is created
curl "http://0.0.0.0:8091/bear"
Result: list with bears should present
curl "http://0.0.0.0:8091/bear"
Result: list with bears should present
curl "http://0.0.0.0:8091/bear/1"
Result: bear with parameters
curl "http://0.0.0.0:8091/bear/100000"
Result: Empty
Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "PUT" "http://0.0.0.0:8091/bear/1" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BROWN",
"bear_name": "Nike",
"bear_age": 10
}'
Result: Bear is updated
Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "PUT" "http://0.0.0.0:8091/bear/1" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "",
"bear_name": "",
"bear_age": null
}'
Result: Bear is not updated
Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "PUT" "http://0.0.0.0:8091/bear/1" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "",
"bear_name": "Mike",
"bear_age": 7
}'
Result: Bear is not updated
Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "PUT" "http://0.0.0.0:8091/bear/1" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "test",
"bear_name": "Mike",
"bear_age": 7
}'
Result: Bear is not updated
Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "PUT" "http://0.0.0.0:8091/bear/1" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "Black",
"bear_name": "",
"bear_age": 7
}'
Result: Bear is not updated
Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "PUT" "http://0.0.0.0:8091/bear/1" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BLACK",
"bear_name": "Mike",
"bear_age": null
}'
Result: Bear is not updated
- PUT /bear/:id - update specific bear with null bear_age Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "PUT" "http://0.0.0.0:8091/bear/1" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BLACK",
"bear_name": "Mike",
"bear_age": null
}'
Result: Bear is not updated
- PUT /bear/:id - update specific bear with boolean bear_age Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "PUT" "http://0.0.0.0:8091/bear/1" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"bear_type": "BLACK",
"bear_name": "Mike",
"bear_age": true
}'
Result: Bear is not updated
- Delete /bear - delete all bears (bears are exist)
curl "http://0.0.0.0:8091/bear"
Result: Bears are deleted
- Delete /bear - delete all bears (bears aren't exist)
curl "http://0.0.0.0:8091/bear"
Result: nothing happens
- Delete /bear/id -- delete specific bear Bear with parameters {"bear_id":1,"bear_type":"BLACK","bear_name":"Mike","bear_age":17.5} is exist
curl -X "DELETE" "http://0.0.0.0:8091/bear/1"
Result: Bear was deleted
- Delete /bear/id -- delete specific bear Bear with id is not exist
curl -X "DELETE" "http://0.0.0.0:8091/bear/1"
Result: nothing happens