Following snippets can be used for testing RESTful API:
# simulate form submission
curl -X POST -F 'name=test' -F 'password=123' -F 'csrf_token=abc' http://127.0.0.1:8000/login
# or
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'name=test&password=123&csrf_token=abc' http://127.0.0.1:8000/login
# post JSON
curl -X POST -H "Content-Type: application/json" -d '{"name":"title1", "role":"role1"}' http://127.0.0.1:8000/user
# plain GET
curl -X GET http://127.0.0.1:8000/user/1
curl -X GET http://127.0.0.1:8000/user
# PUT
curl -X PUT -H "Content-Type: application/json" -d '{"name":"other title1", "role":"other role1"}' http://127.0.0.1:8000/user/1
# DELETE
curl -X DELETE http://127.0.0.1:8000/user/1