I want to call the GraphQL API for Jira in my Exalate mapping scripts. Is there any support for that, other than basic authentication with my access token right there in the script?
The following returns null for the user, as if the request was unuauthneticated:
def query = """
query me {
me {
user{
name
}
}
}
"""
httpClient.post("/gateway/api/graphql", new JsonBuilder([ query: query ]).toPrettyString())
Something requiring authentication results in an “unauthenticated” error:
def query = """
query example {
tenantContexts(hostNames:["mysite.atlassian.net"]) {
cloudId
orgId
}
}
"""
httpClient.post("/gateway/api/graphql", new JsonBuilder([ query: query ]).toPrettyString())
Returns:
{
"errors": [
{
"message": "Auth category: UNAUTHENTICATED is not allowed in service tcs",
"locations": [],
"extensions": {
"allowedAuth": ["API_TOKEN", "SESSION"],
"presentedAuth": "UNAUTHENTICATED",
"errorSource": "GRAPHQL_GATEWAY",
"statusCode": 403.0,
"agg": { "severity": "NORMAL", "ugcPiiSafe": true },
"classification": "IncorrectAuthException"
}
}
],
"data": { "tenantContexts": null },
"extensions": {
"gateway": {
"request_id": "219bcf3c-525a-46c5-abd4-cd8980e8dac2",
"trace_id": "219bcf3c525a46c5abd4cd8980e8dac2",
"crossRegion": false,
"edgeCrossRegion": false
}
}
}
If I use the API gateway URL at https://api.atlassian.com/graphql, I also get a 401 error.