Skip to main content
All CollectionsWrk Action LibraryJIRA
Perform an API call in Jira
Perform an API call in Jira
Wrk Product avatar
Written by Wrk Product
Updated over a week ago

Perform an API call in Jira by specifying the endpoint URL, selecting the desired HTTP method, including request headers (in JSON format), providing an optional request body, and optionally attaching a file.

Note: The endpoint for this Wrk Action is non-standard. Please scroll to the bottom of this documentation to review "How to configure your endpoint".

Application

  • Jira

Inputs (what you have)

Name

Description

Data Type

Required?

Example

Endpoint

The URL of the API endpoint to access

Text (Long)

Yes

https://api.example.com/users

Method

The HTTP method to be used for the request

Predefined Choice List

Yes

GET

Request headers

Additional headers to include in the request in JSON format

Text (Long)

No

{"Content-Type": "application/json"}

Request body

The data to be included in the request body

Text (Long)

No

{"name": "John", "age": 25}

File

A file to be included in the request

File

No

example.png

Note: the value of inputs can either be a set value in the configuration of the Wrk Action within the Wrkflow, or a variable from the Data library section. These variables in the Data library section are the outputs of previous Wrk Actions in the Wrkflow.


Outputs (what you get)

Name

Description

Data Type

Required

Example

Response status code

The HTTP status code returned in the response

Integer

Required

200

Response headers

Additional information provided in the response headers

Text (Long)

Optional

Content-Type: application/json

Response body

The main content of the response

Text (Long)

Optional

{"message": "Success"}

Downloaded file

A file that is downloaded as part of the response

File

Optional

example.pdf

Note: The "Fields to Capture" input feature can be used to create new outputs for the Wrk Action with the value of the corresponding key name in the first-level JSON output of the Wrk Action.

Example: If the "Response Body" output is equal to {"message": "Success"} Then you are able to add a "Fields to capture" input with the name "message" that will add an output to the Wrk Action called "message" which will have the value "Success"


Outcomes

Name

Description

Success

This status is selected in the event of that the API call returns with a status between 200-399

Unsuccessful

This status is selected in the event of that the API call returns with a status of 400+

Impossible to Complete

This status is selected in the event of the following scenario:

  • Couldn't resolve hostname

  • The external system is not accessible

How to configure your endpoint

  • The Endpoint used for this Wrk Action has the below structure: https://api.atlassian.com/ex/jira/{cloudId}/rest/api/3/

    Example:https://api.atlassian.com/ex/jira/93ac17d7-fe07-4ba3-a53c-5caeb380fff8/rest/api/3/issue/DEMO-1

  • The simplest way to find your site's Cloud ID is by copying and pasting the below URL into your browser:
    https://my-site-name.atlassian.net/_edge/tenant_info
    When you replace "my-site-name" with your Jira site name, this will return the below containing your cloudId.
    {"cloudId":"93ac17d7-fe07-4ba3-a53c-5caeb380fff8"}

    Note: This can be done once as you set up your Wrkflow or programatically by using this Wrk Action to make a Get request to "https://my-site-name.atlassian.net/_edge/tenant_info"

Did this answer your question?