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 Leaders.
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

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?

Suggest an answer

Log in or Sign up to answer