GET issue ID based on content of custom field

I would like to find the issue id and readable id based on the content of a custom field. Is there any direction I can follow to do this?

3 comments
Comment actions Permalink
Official comment

Hello Michael,

how exactly are you retrieving the content of a custom field? What does the request look like in this case?

Comment actions Permalink

Good afternoon Liubov,

According to the documentation, I can find the value of a custom field by first knowing the issue id/readable id. I followed that process which then led me to create the following GET statement:

curl -X GET \
'https://youtrack.allpack.local/api/issues/APE-518/customFields/114-16?fields=id,projectCustomField%28id,field%28id,name%29%29,value%28id,isResolved,localizedName,name%29' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer perm:XXXXX' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json'

From this statement, I get the following response:

{
"projectCustomField": {
"field": {
"name": "jobid",
"id": "66-45",
"$type": "CustomField"
},
"id": "114-16",
"$type": "SimpleProjectCustomField"
},
"value": 23200,
"id": "114-16",
"$type": "SimpleIssueCustomField"
}

 

This is fine. However, if I have the value of the field id 114-16, which is 23200. Is there a way to reverse the search to GET the value of the ID of the issue based on having the value of the field id 114-16, 23200?

0
Comment actions Permalink

Hello Michael,

well, I believe that the basic search feature of YouTrack will be most helpful in this case.

There might be many issues with the same value of the same custom field in your YouTrack, so you need to run a simple search query like `jobid: 23200` and find all issues with that value.

When it comes to REST requests, running such search query would look like this:

GET https://youtrack.allpack.local/api/issues?query=jobid:%2023200&fields=id,idReadable,summary,description

Here's the link to the documentation: https://www.jetbrains.com/help/youtrack/incloud/resource-api-issues.html#get_all-Issue-method

 

I hope this helps! Let me know if you have any further questions.

0

Please sign in to leave a comment.