The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Graphql Python

Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 15, 2021

Is there any sample codes available to understand how to use GraphQL Atlassian JIRA APIs with Python? REST APIs have good documentation on how to use those with various programming languages.

I could find only this link which does not give many details

https://developer.atlassian.com/platform/atlassian-graphql-api/graphql/#examples

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Stephan Brown
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 10, 2022

Don't know if you're still looking for this, but here's an example of a query in a python class:

import requests
import os
import json
class AtlassianApi:
username = os.getenv("JIRA_API_USERNAME")
token = os.getenv("JIRA_API_TOKEN")
gql_host = "https://api.atlassian.com/graphql"

def graphql_call(self):
graphql_query = """[your query here]"""
response = requests.post(url=self.gql_host, auth=(self.username, self.token), json={'query': graphql_query})
return response

Hope this helps in case anyone stumbles on this.

Madison
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 23, 2023

You are amazing. 

Yogesh Ranjitkar
June 8, 2023

Hi @Stephan Brown , with your code, don't we need to pass the XRAY TOKEN to call the graphql APIs?