Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

The Web service node helps you integrate Jira Service Management with Koji. It sends a request to a web service, obtains, and parses the returned result. This page describes how to use this node.

Jira Cloud Platform APIs

The REST APIs help developers integrate Jira Service Management with Koji. To learn more about JSM REST APIs functionality and view the references, visit the Atlassian Developer REST API portal.

Node prerequisites

Before using JSM APIs in your workflow, you must obtain the Session Auth Token, which is required for proper APIs performance. To do so:

1. In your workflow, create a Call function node.

2. In the Function name field, specify the wf.itsm.ticket.get_authorization_header function. It returns Session Auth Token.

3. Save the result in a variable. For example, it can be user_token.

4. Add the Authorization = user_token pair in the Web service node's header part.

Now you can start using JSM APIs in your workflows.

Web service node usage

Use the Web service node to send a request to a web service, obtain, and parse the returned result. Fill in the fields:

  • URI: specify the URL of Web Service that Kbot shall use.

  • Method: select the required method from the drop-down list: POST, GET, PUT, or DELETE.

  • Headers, Parameters, Body data: these fields are for the input data of the request. These parameters are sent to the service. Specify this data in accordance with the documentation of the API that you are using.

  • Patterns: save your request’s JSON results. You can save a result to the internal variable for the following usage in the Workflow. The patterns' data is stored as the argument name - argument value pairs.

Sample

Let’s create a workflow that returns a status for a given request. For such a workflow we are going to use the Get customer request by id or key method. It is used to return a given’s request status by ID or key. Our workflow will consists of multiple nodes described below.

1. Go to Content > Workflows.

2. Click Create and name your workflow.

3. In the workflow details view, click Edit workflow.

4. Create the Call function node for obtaining the authorization details. In the Function name field, specify the wf.itsm.ticket.get_authorization_header function, which returns Session Auth Token. Save the result in a variable (in this sample it is user_token).

5. Create the Ask node to ask a user their request key. Save the result in a variable (in this sample it is user_ticket).

6. Create the Save to short term memory node, name the property (in this sample it is get_request) and specify the method, as it is described in the Atlassian reference documentation.

7. Create the Web service node. Specify the URI, the API method type (as it is defined in the Atlassian documentation), headers (the Authorization comes from the first Call function node; Accept = application/json), and the pattern.

To get and utilize the ticket status later on in our workflow, in the Patterns section add a variable for storing the status. The value of this variable corresponds to the path in the response JSON object. For instance, the status in this case is $.currentStatus.status.

8. Click Save. Now you can test your workflow.

9. Open the chat and type the #workflow <workflow_name> chat command. In out sample, it is #workflow APItest.

10. Enter the key of your ticket and see its status. To check that everything is correct, you can open the ticket separately and make sure the result is accurate.

  • No labels