User operations in the Jira adapter
This topic provides input and output elements, and sample XML requests and responses for the operations in the User folder.
When you use a context item as an input for an adapter request, you must enclose the adapter request in the <request-data> elements. However, when you create a static request, <request-data> is not required and the adapter request starts with the <jira-adapter-request> element.
Login
Logs in to the session.
The following table describes the input elements for the adapter wrapper process.
Input element | Description | Required |
|---|---|---|
adapter name | Specifies the name of the adapter as configured on the grid. Default value: Jira Adapter | Conditional; required if not specified in the adapter configuration |
url | Specifies the URL for the JIRA server. Example: https://jira.com | Conditional; required if not specified in the adapter configuration |
If using the Call Adapter activity in the Development Studio, the following table describes the input elements for the adapter request.
Input element | Description | Required |
|---|---|---|
<return-data-format> | Specifies the data type for the adapter response. | No |
<operation-name> | Specifies the name of the operation. Valid value: login | No |
<headers> | Specifies the header details for the adapter request, in a JSON format. Contains the URL, return-data-format, and other JSON headers. | No |
The following figure shows a sample XML request for the Login operation.
<operation-name>login</operation-name>
<headers>{
"return-data-format":"XML",
"headers" : {
"Content-Type": "application/json"
}
}
</headers>
</jira-adapter-request>
The following figure shows the adapter response for the request.
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>200</reason>
</status-line>
<header-lines>
<Date>Thu, 27 Jun 2019 20:18:12 GMT</Date>
<Server>Apache/2.4.29 (Red Hat)</Server>
<X-AREQUESTID>918x3263561x2</X-AREQUESTID>
<X-ANODEID>phx-jiraprd-01</X-ANODEID>
<X-XSS-Protection>1; mode=block</X-XSS-Protection>
<X-Content-Type-Options>nosniff</X-Content-Type-Options>
<X-Frame-Options>SAMEORIGIN</X-Frame-Options>
<Content-Security-Policy>frame-ancestors 'self'</Content-Security-Policy>
<X-ASEN>SEN-5981199</X-ASEN>
<Set-Cookie>atlassian.xsrf.token=BXV8-9FAB-2I0V-4AN7_72cc8edaf4878f5759f5c15aa0e77c85aaacf00d_lout; Path=/; Secure</Set-Cookie>
<X-AUSERNAME>anonymous</X-AUSERNAME>
<Set-Cookie>JSESSIONID=409EF28EE254552298C13D3BAB31CFDD; Path=/; Secure; HttpOnly</Set-Cookie>
<X-Seraph-LoginReason>OK</X-Seraph-LoginReason>
<Cache-Control>no-cache, no-store, no-transform</Cache-Control>
<Vary>User-Agent</Vary>
<Content-Type>application/json;charset=UTF-8</Content-Type>
<Connection>close</Connection>
<Transfer-Encoding>chunked</Transfer-Encoding>
</header-lines>
<message-body>
<loginInfo>
<failedLoginCount>75</failedLoginCount>
<lastFailedLoginTime>2019-06-25T02:12:36.121-0500</lastFailedLoginTime>
<loginCount>890</loginCount>
<previousLoginTime>2019-06-27T15:16:54.320-0500</previousLoginTime>
</loginInfo>
<session>
<name>JSESSIONID</name>
<value>409EF28EE254552298C13D3BAB31CFDD</value>
</session>
</message-body>
</jira-adapter-response>
The following table describes the output elements for the Login operation.
Output element | Description |
|---|---|
JSESSIONID | Contains the session ID to be used for all operations. |
status | Shows the status of the operation. Valid values: success, failure |
adapter-response | Contains the adapter response for the operation. |
error message | Shows an error message, if the operation fails. |
Get Current User Details
Retrieves the username of the currently logged-in user.
The following table describes the input elements for the adapter wrapper process.
Input element | Description | Required |
|---|---|---|
JSESSIONID | Specifies the session ID obtained from the login request. | Yes |
adapter name | Specifies the name of the adapter as configured on the grid. Default value: Jira Adapter | No |
If using the Call Adapter activity in the Development Studio, the following table describes the input elements for the adapter request.
Input element | Description |
|---|---|
<operation-name> | Specifies the name of the operation. Valid value: current-user |
<headers> | Specifies the header details for the adapter request, in a JSON format. Contains the URL, return-data-format, and other JSON headers. |
<return-data-format> | Specifies the data type for the adapter response |
<cookie> | Specifies the JSESSIONID cookie obtained during the Login operation. |
The following figure shows a sample XML request for the Get Current User Details operation.
<operation-name>current-user</operation-name>
<headers>{
"return-data-format":"XML",
"headers"
: {
"Content-Type": "application/json",
"Cookie":
"JSESSIONID=D5E9E13B9CB519C2470CD0AB0F97B18B"
}
}
</headers>
</jira-adapter-request>
The following figure shows the adapter response for the request.
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>200</reason>
</status-line>
<header-lines>
<Date>Wed, 17 Jul 2019 16:35:37 GMT</Date>
<Server>Apache/2.4.29 (Red Hat)</Server>
<X-AREQUESTID>695x44x1</X-AREQUESTID>
<X-ASESSIONID>qcfez4</X-ASESSIONID>
<X-ANODEID>phx-jiraqa-01</X-ANODEID>
<X-XSS-Protection>1; mode=block</X-XSS-Protection>
<X-Content-Type-Options>nosniff</X-Content-Type-Options>
<X-Frame-Options>SAMEORIGIN</X-Frame-Options>
<Content-Security-Policy>frame-ancestors 'self'</Content-Security-Policy>
<X-ASEN>SEN-L13798850</X-ASEN>
<X-Seraph-LoginReason>OK</X-Seraph-LoginReason>
<Set-Cookie>atlassian.xsrf.token=BXV8-9FAB-2I0V-4AN7_5029a258b1d6e9b107423ec2dc04df774dd0e654_lin; Path=/</Set-Cookie>
<X-AUSERNAME>username</X-AUSERNAME>
<Cache-Control>no-cache, no-store, no-transform</Cache-Control>
<Vary>User-Agent</Vary>
<Content-Type>application/json;charset=UTF-8</Content-Type>
<Connection>close</Connection>
<Transfer-Encoding>chunked</Transfer-Encoding>
<X-RBT-SCAR>172.29.65.106:681537107:1000</X-RBT-SCAR>
</header-lines>
<message-body>
<loginInfo>
<failedLoginCount>14</failedLoginCount>
<lastFailedLoginTime>2019-02-21T01:14:46.125-0600</lastFailedLoginTime>
<loginCount>842</loginCount>
<previousLoginTime>2019-07-17T11:34:35.094-0500</previousLoginTime>
</loginInfo>
<name>username</name>
<self>http://jira.com/rest/api/latest/user?username=username</self>
</message-body>
</jira-adapter-response>
The following table describes the output elements for the adapter request.
Output element | Description |
|---|---|
current-user | Contains the username of the currently logged-in user. |
adapter-response | Contains the adapter response for the operation. |
status | Shows the status of the operation. Valid values: success, failure |
error message | Shows an error message, if the operation fails. |
Logout
Logs out of the session.
The following table describes the input elements of the adapter wrapper process of the Logout operation.
Input element | Description | Required |
|---|---|---|
JSESSIONID | Specifies the Jira session ID that you obtained after running the Login request. | Yes |
adapter name | Specifies the name of the adapter as configured on the grid. Default value: Jira Adapter | No |
If using the Call Adapter activity in the Development Studio, the following table describes the input elements for the adapter request.
Input element | Description |
|---|---|
<operation-name> | Specifies the name of the operation. Valid value: logout |
<headers> | Specifies the header details for the adapter request, in a JSON format. Contains the URL, return-data-format, and other JSON headers. |
<return-data-format> | Specifies the data type for the adapter response. |
<cookie> | Specifies the JSESSIONID cookie obtained during the Login operation. |
The following figure shows a sample XML request for the Logout operation.
<operation-name>logout</operation-name>
<headers>{
"headers"
: {
"Content-Type": "application/json",
"Cookie":
"JSESSIONID=D5E9E13B9CB519C2470CD0AB0F97B18B"
}
}
</headers>
</jira-adapter-request>
The following figure shows the adapter response for the request.
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>204</code>
<reason>204</reason>
</status-line>
<header-lines>
<Date>Wed, 31 Jul 2019 08:40:55 GMT</Date>
<Server>Apache/2.4.29 (Red Hat)</Server>
<X-AREQUESTID>220x4439x1</X-AREQUESTID>
<X-ASESSIONID>qsbbho</X-ASESSIONID>
<X-ANODEID>phx-jiraqa-01</X-ANODEID>
<X-XSS-Protection>1; mode=block</X-XSS-Protection>
<X-Content-Type-Options>nosniff</X-Content-Type-Options>
<X-Frame-Options>SAMEORIGIN</X-Frame-Options>
<Content-Security-Policy>frame-ancestors 'self'</Content-Security-Policy>
<X-ASEN>SEN-L13798850</X-ASEN>
<X-Seraph-LoginReason>OK</X-Seraph-LoginReason>
<Set-Cookie>atlassian.xsrf.token=BXV8-9FAB-2I0V-4AN7_58358f81956c4de6eea6f3f2d1aa5634df223df4_lin; Path=/</Set-Cookie>
<X-AUSERNAME>jira-qa</X-AUSERNAME>
<Set-Cookie>JSESSIONID=520D00210153177FA84AD3F5B9C4CF92; Path=/; HttpOnly</Set-Cookie>
<Cache-Control>no-cache, no-store, no-transform</Cache-Control>
<Content-Type>application/json;charset=UTF-8</Content-Type>
<Connection>close</Connection>
<X-RBT-SCAR>172.29.65.114:709653223:1000</X-RBT-SCAR>
</header-lines>
<message-body>
<non-xml-data-response />
</message-body>
</jira-adapter-response>