See https://github.com/jrervin/splunk-rest-examples for examples of how to make a REST endpoint in Splunk.
There are also some helper libraries that you can use.
Here is a library for helping to create a REST handler for providing access to a custom .conf file: https://github.com/LukeMurphey/splunk-network-tools/blob/master/src/bin/network_tools_app/simple_res...
Here is a helper library for a generic REST endpoint: https://gist.github.com/LukeMurphey/238004c8976804a8e79570d22721fd99
We've just released updated documentation on custom REST endpoints: https://dev.splunk.com/enterprise/docs/developapps/customrestendpoints/
Please let us know if this helps answer your question. We'd also love to hear about feedback or suggestions for improvement.