Trigger an API via web URL

Hi all, new to Powershell Universal and i was wondering is there any way to trigger an API script from a web URL, ideally id like to have a button within our documentation system that by clicking on it triggers a custom API in PU to run.

The same way that i can setup an Azure Function to simply run from an HTTPS URL trigger

Thanks

Rhys

image

You certainly can. You just need to engineer it correctly. I’m not sure what you are intending to do, and what the capabilities of the documentation system are, but if that system allows you to make webcalls then… Should be completely possible.

Hi Jori

Thanks for that, is it possible to trigger a POST with passing a variable through from the browser’s URL? i can get a very basic script like yours working, but when i try to implement something with POST and a variable. i get page not found errors

no matter how i try to browse / pass through form the browser

image

Really appreciate your input on this

You would need to use query strings.

What are you using for documentation? The button in that system would need to do the POST method, it’s not something that can be specified in the URL. Same if you wanted to pass paremeters/data in the body.

So tldr; you can accomplish what you want with a GET request, but your documentation system may have more and better options.