|
1 |
| -# WebSvcConnector |
| 1 | +# WebSvcConnector |
| 2 | +Here you find PowerShell sample code calling into the ScriptRunner WebService Connector. |
| 3 | + |
| 4 | +The primary intension of this code is to serve as a detailed source of API documentation. |
| 5 | +In fact it should be quite easy to implement the same behavior in other scripting languages, |
| 6 | +like Perl or Python, e.g. using CURL to send the web requests. |
| 7 | + |
| 8 | +However this code will also come in handy to test your settings during configuration. |
| 9 | +In a basic setup you can use the scripts and functions locally on the ScriptRunner host, |
| 10 | +using the built-in Loopback WebService Connector instance, but the code is not limited |
| 11 | +to local execution, it is only the ScriptRunner endpoint URL that needs more attention |
| 12 | +from remote. |
| 13 | + |
| 14 | +The ScriptRunner WebService Connector provides three different endpoint APIs to start an Action: |
| 15 | + - Action OData API, on http[s]://server:port/ScriptRunner/ActionContextItem... |
| 16 | + - Action Webhook API, on http[s]://server:port/ScriptRunner/api2/PostWebhook/$ActionID |
| 17 | + - Azure PowerAutomate API, on http[s]://server:port/ScriptRunner/api2/StartAction |
| 18 | + |
| 19 | +WebSvcConnector.ps1 is a container of three main functions, one for each of these endpoints. |
| 20 | +So after you load (dot-source) the script, you have three functions available: |
| 21 | + |
| 22 | + - Start-AsrWebSvcConnector to call the Action OData API, |
| 23 | + - Start-AsrWebhook to call the Action Webhook API, and |
| 24 | + - Start-AsrWebSvcConnector2 to call the Azure PowerAutomate API |
| 25 | + |
| 26 | +The functions use Windows Integrated Auth (with the current user) by default, but also provide a |
| 27 | +$BasicAuthCreds PSCredential parameter for Basic Authentication. |
| 28 | +For the constructed API URLs to have the correct protocol, host, and port, you specify either |
| 29 | +the appropriate ScriptRunner endpoint (like 'http://server:port/ScriptRunner/' or |
| 30 | +'https://server:port/ScriptRunner/'; check your ScriptRunner installation to use the correct |
| 31 | +settings), or the complete API URL. |
| 32 | + |
| 33 | +Other parameters provide the appropriate data for the respective API. |
| 34 | + |
| 35 | +In addition to this WebSvcConnector.ps1 script, there are three scripts, one for each of the |
| 36 | +APIs, that were formerly integrated as sample scripts in your ScriptRunner installation. |
| 37 | +For more details about the scripts, functions, and parameters, check the comprehensive |
| 38 | +Powershell help that is integrated into the scripts. |
0 commit comments