API: system hook request functions and documentation updated

The documentation of the system hooks API is updated, the info to return codes reside in the `README.md` file. A bit of information is added to the documentation and also as code comments to the API functions. Fixed also a small issue when using the system hook API requests without a valid user, it returned a `500 Server Error` instead of `401`. Added tests to check the behaviour.