Search code examples
pythonjirajql

JQL - use variable in query


I'm trying to use variable in JQL

client = 'Newbie'
query = "Managed Services On-boarding " + client
headers = {
    'Content-Type': 'application/json',
}

params = (
    ('jql', 'project="Managed Services" AND summary~'"'+query+'"' AND issuetype="Task" AND status!="DONE"'),
)

above gives me zero result

but if i hard code query i got results

params = (
    ('jql', 'project="Managed Services" AND summary~"Managed Services On-boarding Newbie" AND issuetype="Task" AND status!="DONE"'),
)

is there any way to use variable in JQL ?


Solution

  • You have a mistake with your quotation marks around your query variable. Try it like that:

    client = 'Newbie'
    query = "Managed Services On-boarding " + client
    headers = {
        'Content-Type': 'application/json',
    }
    
    params = (
        ('jql', 'project="Managed Services" AND summary~"'+query+'" AND issuetype="Task" AND status!="DONE"'),
    )