Forums

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

Rest API Returns Wrong Response

Josh Flori February 1, 2023
customfield_27901 == "Parent Link", but the api will not let me filter on customfield_27901, only "Parent Link"

# 1) NO PARENT LINK CONDITION
url = f'{site}/rest/api/2/search?jql=project={epic_type}%20and%20created>' \
f'"2019-12-31"&fields=key,customfield_27901'
# customfield_27901_results == ['CHCAPABLTY-6327', None, None, None, None, 'CHCAPABLTY-6854', None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'CHCAPABLTY-8860', 'CHCAPABLTY-8860', 'CHCA]]

# 2) PARENT LINK IS NOT NULL
url = f'{site}/rest/api/2/search?jql=project={epic_type}%20and%20created>' \
f'"2019-12-31"%20and%20%22Parent%20Link%22%20is%20not%20NULL&fields=key,customfield_27901'
# customfield_27901_results == ['CHCAPABLTY-6327', None, None, None, None, 'CHCAPABLTY-6854', None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'CHCAPABLTY-8860', 'CHCAPABLTY-8860', 'CHCA]]

# 3) PARENT LINK IS NOT EMPTY
url = f'{site}/rest/api/2/search?jql=project={epic_type}%20and%20created>' \
f'"2019-12-31"%20and%20%22Parent%20Link%22%20is%20not%20EMPTY&fields=key,customfield_27901'
# customfield_27901_results == ['CHCAPABLTY-6327', None, None, None, None, 'CHCAPABLTY-6854', None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'CHCAPABLTY-8860', 'CHCAPABLTY-8860', 'CHCA]]

# 4) PARENT LINK IS NULL
url = f'{site}/rest/api/2/search?jql=project={epic_type}%20and%20created>' \
f'"2019-12-31"%20and%20%22Parent%20Link%22%20is%20NULL&fields=key,customfield_27901'
# customfield_27901_results == [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,]

# 5) PARENT LINK ~ "CH"
url = f'{site}/rest/api/2/search?jql=project={epic_type}%20and%20created>' \
f'"2019-12-31"%20and%20%22Parent%20Link%22%20~"CH"&fields=key,customfield_27901'
# customfield_27901_results == []

 

You can see 5 variations of a request and the results of each underneath the request.

My goal is to filter where Parent Link contains "CH' or at least where it's not null. Although I've implemented those conditions, the responses aren't right, as shown in 2), 3), 5) - Each still return null values.

The only filter which actually does something is 4), which filters for and returns only null values.

How can I get this filter working?

1 answer

0 votes
Florian Bonniec
Community Champion
February 1, 2023

Hi @Josh Flori 

 

Parent link has never been working for searching using JQL.

Hope this ticket will help you to understand why

https://jira.atlassian.com/browse/JPOSERVER-2477

 

Parent Link is not EMPTY considers 3 types of "parent links": Parent Link from Portfolio, Epics and subtasks. To search issues with only the Parent Link custom field present, exclude the other possible links:

 

Regards

Josh Flori February 1, 2023

That seems to work, thank you!

Suggest an answer

Log in or Sign up to answer