Validate HTTP API user input

For example, raft indices must be sane integers.
@xiangli-cmu This function is straightforward enough that it won't be an issue. There are a series of checks that, if they fail, they set `err` and `return`. If all of those gates pass, it sets `req` and calls `return`. What exactly are you concerned about here?