Fix RestAPI constructor, fix urirequest, and add support for custom JSON encoder

The constructor still referenced the old name of `RestAPI` (`rest`), so the code could not be used as is. The documentation also used the old name.

The `urirequest` method did not pass the parameters to `urlrequest` correctly. It used positional parameters instead of keyword parameter, causing the body to be sent has headers (in my particular use case).

I have also added support for configuring a custom `JSONEncoder` by setting the `encoder` parameter.
Sorry, did not notice the whitespace changes in my local diff.