Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to query for field with space in its name?

I am using Python requests module to query for a bunch of tickets using JQL.

I want to limit the fields being returned by specifying the "fields" parameter. When I try to use a custom field name with space in the "fields" parameter, Jira does not return the field.

The code I am using is as below

fields = ["summary", "Branch Name"]
data = { 'jql': <jql_query>, 'startAt': 0, 'maxResults': 10, fields=fields }

# session is a Python requests object."{JIRA_REST}/search", data=json.dumps(data))

The response does not include the "Branch Name" field.

Can anyone let me know how to pass in the field name so that it is returned in the response?



2 answers

0 votes

I know this is an old post, but perhaps this will help someone out in the future.

I think a lot of people are getting confused when trying to get values from custom field using SIL when a space is present in the name. It seems that the custom field value is only an string value associated with the field name itself, so you can't return the value without calling the actual field name.

I access from SIL scripts like my code below. Say my custom field is for an Employee Name, and is named as such. I would open a new browser window to the Jira Administration page, go to Issues, click on Custom Fields. locate the field you are looking for and click on the Actions cog wheel dropdown on the righthand side of the page and select, "Configure." Now look at the URL on the page it brought you to and you'll see something like, "customFieldId=10005" at the end. In this case, "customfield_10005" would be the field name.

You can access it like:


//this gets the custom field value from issue bh-01

string key = "bh-01" 

string empName = %key%.customfield_10005;

It seems you are querying through the API so I would try to replace spaces with "%20".

I tried that and that does not seem to help.

what about double quoting the field name, like "'branch name'"

Sadly that didn't help either.

I have tried it the following ways now:

fields = ["summary", '\"Branch Name\"']


fields = ["summary", "Branch%20Name"]


Strangely using Branch Name in JQL query over REST API works:

"jql": "project = PROJECTNAME AND status != Closed AND \"Branch Name\" ~ \”branch_name\””

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you