Best way to split UD between API and client?

How do I best connect to the “remote api” in UD?

just use invoke-restmethod?
or is where are way for a smarter way builtin?