I am trying to do a lookup of an issue's fields values via GraphQL. One reason is to b able to multiple levels of information, but to get the devOps information, and "hopefully" the contents of the Security tab
I am unable to get a basic graphql query to return the values of the issue. I amusing the jira: issueSearchStable method in the following manner
query Jira {
jira {
issueSearchStable(
cloudId: "**cloudID"
issueSearchInput: { jql: "key=**issue_key__" }
) {
totalCount
edges {
node {
issueId
webUrl
fields(first: 80) {
totalCount
edges {
node {
name
description
id
fieldId
aliasFieldId
type
}
}
}
key
isResolved
}
}
}
}
}
I am able to retrieve the issue, and all of the field metadata, but I am not able to retrieve field values. Any guidance on how to get the actual field value?
Thx
Hi!
JiraIssueField, the element returned by the `node` GraphQL field, is an interface. It has child fields, like `id`, `name`, `description`, etc. which, as you have said, describe the Jira field metadata.
The types that implement JiraIssueField will have child fields that contain the actual data for it.
For example, the JiraDateTimePickerField is a concrete type that represents Jira date/time fields. The JiraSingleSelectUserPickerField type is for Jira user fields, etc.
To use those concrete types on queries, you'll have to use GraphQL fragments.
query Jira {
jira {
issueSearchStable(
cloudId: "<cloud-id>"
issueSearchInput: {jql: "key=<issue-key>"}
) {
totalCount
edges {
node {
issueId
webUrl
fields(first: 80) {
totalCount
edges {
node {
__typename
name
description
id
fieldId
aliasFieldId
type
... on JiraSingleSelectUserPickerField {
user {
name
}
}
... on JiraDateTimePickerField {
dateTime
}
}
}
}
key
isResolved
}
}
}
}
}
Note 1: by adding `__typename` under `node` in your query, you'll be able to see the names of the concrete GraphQL types associated with each Jira field.
Note 2: if you only need to query 1 specific issue, you can use `issueById` or `issueByKey`, instead of `issueSearchStable`
Note 3: you can use fieldByIds instead of fields. That allows you to fetch only the specific Jira fields that you are interested in.
fieldsById(ids: ["created", "assignee"]) {
edges {
node {
name
... on JiraSingleSelectUserPickerField {
user {
name
}
}
... on JiraDateTimePickerField {
dateTime
}
}
}
}
Thank you so much @Felipe (and sorry for the delayed response). I needed to go down one additional level (in my example: ... on JiraSingleLineTextField) and I would have gotten the value I was looking for.
What I am trying to capture is the vulnerability information that is supplied by Snyk via a security container (hopefully via a graphql call).
I think this is the path I need to go (instead of the issue) Sorry for the bad copy/past job
query Jira {
devOps {
summarisedEntities(ids: "entityID") {
providers {
securityProviders {
linkedContainers(jiraProjectId: "projectID") {
nodes {
to {
data {
... on DevOpsSecurityVulnerabilityDetails {
id
title
description
url
introducedDate
linkedJiraIssues(type: null) {
nodes {
to {
data {
... on JiraIssue {
issueId
id
}
}
}
}
}
}
}
}
}
}
name
homeUrl
}
}
}
}
}
I need to determine the value of entityID(s), so if there is any guidance, it would be appreciated (or if there is related documenation)
Ken
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.