Info | ||
---|---|---|
| ||
This feature is available starting with v4.5.0. |
...
To define what URI and HTTP method(s) will be used to invoke a specific SIL™ script, use the SIL Webhooks configuration.
- Log in to your Jira as Admin.
- Go to your Administration > Add-ons > CPRIME PLUGINS CONFIGURATION > SIL Webhooks Configuration.
- To create a Webhook entry, click the the Add webhook button.
A screen like the following will appear: - Fill in the parameters in the form:
- Name - the name of the webhook. This will be used as an identifier for the webhook configuration.
- Methods - the HTTP method (or methods) to bind the webhook to.
- Script - SIL™ script that will run when calling this webhook.
- Synchronized - the sync/async configuration for the webhook.
Note title NOTE The difference between synchronous and asynchronous is that the asynchronous Webhook SIL call can't return any results or custom HTTP codes to the caller. This happens because the SIL script run task is added to a list of future tasks to be run, and the HTTP call ends.
With the synchronous option, the call will block until the SIL script run is completed, and the results will be returned to the caller.
- Save the configuration.
After you save the configuration, a new entry like the following one will show up:
The URI column in the table will help you run your newly created webhook. For example if your Jira installation instance is located at http://localhost, you can run the webhook using the http://localhost/rest/keplerrominfo/refapp/latest/webhooks/mysilwebhook/run address with the selected HTTP method(s).
...
If you configured the Webhook to be available for the GET HTTP method, you can test the webhook in the browser, giving it custom query parameters, and the result could look something like this (the above SIL script was used):
Note | ||
---|---|---|
| ||
On cloud, the link above would require using In Power Scripts for Cloud, the prefix for the above link should be the add-on URL and adding the JWT as a query parameter.(https://pscloud.cprime.com/refapp/rest/keplerrominfo/refapp/latest/webhooks/test/run?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJjb20ua2VwbGVycm9taW5mby5qaXJhLnBsdWdpbnMuamp1cGluIiwiY2xpZW50S2V5IjoiZTAxMjEwMDAtYWViNC0zMDcwLWE3YjUtNzYyODAxZGE3NzlkIiwiaXNzIjoiY29tLmtlcGxlcnJvbWluZm8uamlyYS5wbHVnaW5zLmpqdXBpbiIsImV4cCI6MTU5MTg4NDYwOSwiaWF0IjoxNTkxODgzNzA5fQ.pO-0EK_-WfczydvCrjBZ7iZjO5tV5e1zj0199xQUxVk). Also, the JWT query parameter will be needed, and will be accessible fron the SIL webhook script. More details about how the JWT works are here. If you can't find out how to generate one by yourself, the easiest way to get one is to open one of our pages (for example, the SIL Webhooks Configuration) in a new tab and copy it from that URL directly. Note that you'll have to consider this parameter in your SIL script as well. |
Webhooks authentication
For the REST/HTTP client to be able to make any Webhooks calls, it needs to be authenticated into the Jira / Confluence instance.
...