How to tell what module is running from a function call?
You could get the calling function from calling debug_backtrace(). Another way would be to pass it in:

_rest_api_do_request(__FUNCTION__);


However, either seems like a bad pattern. It's fine for debugging, but a function shouldn't require knowledge of what it is calling it. That's an unnecessary dependency.