Hi,
I want to lookup some issues through the graphql API and managed to put together the components in GraphQL explorer.
Now trying this in a node app, I get the error:
Invalid JQL: Field 'type' does not exist or this field cannot be viewed by anonymous users.
This is how I put together the request:
I also copy the token from https://id.atlassian.com/manage-profile/security/api-tokens
async function fetchIssueIds() {
const response = await fetch('https://MYINSTANCE.atlassian.net/gateway/api/graphql', {
method: 'POST',
headers: {
'Authorization':"MYTOKEN-copied-from-https://id.atlassian.com/manage-profile/security/api-tokens",
'Content-Type': 'application/json',
"X-ExperimentalApi":"JiraIssueSearch"
},
body: JSON.stringify({
query: `query example {
jira {
issueSearchStable(cloudId: "MYCLOUDID", issueSearchInput: {jql: "type = 'Idea'"}) {
edges {
node {
id
}
}
}
}
}`
}),
});
const responseBody = await response.json();
return responseBody.data.jira.issueSearchStable.edges.map(edge => edge.node.id);
}
Not sure about the Token format, but from what I found this would be it.
I appreachiate any help!
Unfortunately the documentation is really bad for this. With the help from the support team i figured the resolution:
First, the domain you use does not matter.
'Authorization':"Basic InserTokenHere"
your@emailaddress.com:MYTOKEN-copied-from-https://id.atlassian.com/manage-profile/security/api-tokens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.