Working with UD REST APIs



I am new to using universal dashboard, I have managed to create a rest api using the community edition and it works excellent.

My questions are: How can I create a rest api using universal dashboard community edition to upload and download files and how would be the server and the client Powershell sides?

Thank you in advance for your help.


Very cool! What would be the recommended strategy if I want to make a REST interface to a database with multiple types of information, like “users”, “devices”, “applications”, etc.? Is there a way to expose those through one web service (same TCP port), or would it be better to separate them?

Hi @LaranIkal,
Apologies for the late reponse,
Currently the RESTapi doesn’t support file-transfer.

Currently a “help wanted” tag on the issue on github

1 Like

Hi @skatterbrainz,
I’m a big fan of using the same webserver / port, however from an security perspective it depends on your configuration.
Personally, i run the public RESTapi on a separate port. Both because externally port 443 is used, and i don’t want my entire dashboard publicly avaliable.

Thanks! This particular project would be all internal-facing, no public interface (external to the environment, that is). Server123 would host the endpoint, and requests would come from other devices on the same internal network.

Also, I’m not really familiar with the -AutoReload parameter besides it reloading when the script is updated. Does it periodically resubmit the script code even when not modified?

Hi again @skatterbrainz

Run it all on the same webserver, and same binding. No need to overcomplicate anything.

As far as the -AutoReload function, it seems (quickly reading the source code) that it is watching the dashboard file for changes, and on a change it reloads the dashboard. Should not intermittently reload the site if you don’t make changes to your dashboard.ps1.

So, following the example above, I ended up with a URL like “http://localhost:10001/api/devices” but I’d like to have “/users” and “/apps” as well, on the same port. But each of those needs unique queries and datasets. How can I pull that off using one TCP port?

Morning @skatterbrainz

You add it in the Start-UDDashboard -Endpoint param.

Start-UDDashboard -Dashboard $dashboard -Endpoint @($API1, $OtherAPI, $Resting) -wait

1 Like