merge the params from REST requests.

1. merge the params from REST requests.
2. add helper function to get path. the code just from function "dispatch".