How can I use sercTerm filter in Jira Servicedesk?

Deleted user July 18, 2018

Hello,

how can I use searchTerm filter in Jira Servicedesk?

This is the link of Jira API

https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/#servicedeskapi/request-getMyCustomerRequests

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2018

Hi Jack,

The document you reference here is a Service Desk REST API guide.   One way to make this kind of REST GET call, is to use a utility like curl.  There are cited examples of how you can use this utility and pass it authentication, headers, etc, along with sometime a json payload in order to obtain the results of that request.   More examples of doing this are in https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/

In this specific case, calling that REST endpoint has other parameters like searchTerm that get passed into the URL itself.   So if you wanted to search your own requests for the term 'migrate' the URL you would call in your REST would look something like this

http://jira.example.com/rest/servicedeskapi/request?searchTerm=migrate

 

You would still need to handling authentication and the other headers, so if you were using curl do to this, your command might look more like this:

curl \
   -D- \
   -u fred:fred \
   -X GET \
   -H "Content-Type: application/json" \
   http://jira.example.com/rest/servicedeskapi/request?searchTerm=migrate
Deleted user July 24, 2018

Thanks for support!

Ian Russel Adem July 9, 2020

How do you perform for issueKey? For instance my issueKey='Host1234ID', how do you add that to the searchTerm query  parameter ?

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 13, 2020

Hi @Ian Russel Adem 

The endpoint that the previous user mentioned was GET /rest/servicedeskapi/request  however that specific endpoint doesn't let you search by issuekey.  The searchTerm parameter in that endpoint specifically says it is only looking at the Summary field.

searchTerm string

Filters results to customer requests where the issue summary matches the searchTerm. You can use wildcards in the searchTerm.

So I don't expect that the searchTerm parameter here to be able to use issuekey when searching because the issuekey is not part of the request/issue summary.

If you already know what the Issuekey is, then you can instead try using the GET /rest/servicedeskapi/request/{issueIdOrKey} endpoint.  But if you are specifically looking for a way to search for requests in the Jira Service Desk REST API by issue key, I don't think it's possible.  Licensed Jira users might be able to use JQL search as described in GET /rest/api/3/search.  JQL can let you make that kind of search.  But unlicensed users that are only in Jira Service Desk's customer role won't be able to make a call like this.  Their account simply lacks the privileges to make this kind of search.

Ian Russel Adem July 13, 2020

@Andy Heinzer  I am referring to this  https://support.atlassian.com/jira-core-cloud/docs/advanced-search-reference-jql-fields/. So you mean, to use try and use this functionality, a user must be a licenced jira user, not the customer one. Also I need to fetch servicedesk request by priority, do you know how to implement using the searchTerm ?priority.png

 

priority="High"

 

How do you filter the request using searchTerm ?

blah/rest/servicedeskapi/request?searchTerm=

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 15, 2020

That link you are referring to is the JQL search reference.  That is not the same as the 'searchTerm' parameter which is used by Jira Service Desk REST API.

Yes, in order to use JQL searching anywhere in Jira (REST API or web interface), users have to be licensed Jira users.  It is not possible for users that are only in the customer role (unlicensed users) to use JQL searching at all.

The searchTerm parameter is only used by the Jira Service Desk REST API.  However from reviewing that document, priority does not appear to be something it can returned there.  The customer portal in Jira Service Desk does not show this value either.  Since that priority information is on the issue side, not the request side, this is something that I believe is only going to be something you can retrieve using the Jira Core REST API (licensed Jira users only).

You could call the endpoint GET /rest/api/2/search and pass the JQL of something like

project=XYZ and Priority=High

in order to return issues in that project with that priority.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events