This question has been posing a few issues recently but a number of clients have been attempting to return a list of requests via the API by a specific value on the Request such as Group. As with a lot of these things its pretty simple but not immediately obvious if you don’t know where to look for the information.
 
First off you might want to download my API white paper which sets the groundwork for using the API interface in ServiceDesk Plus:
 
 
If you’re confident with the content of the white paper lets review the API interface operations we’ll need to get a list of requests (you can locate this in the API documentation under Admin – General Settings – API in the GUI of ServiceDesk Plus).
 
The first operation we are interested in is ‘View All Requests’ as shown from the API documentation below:
  
 
 
 
 FilteringReq1
 
 
 
 
 
 
 
The operation has a few controls of interest namely ‘from’, ‘limit’ and ‘filterby’. Now the first two are hopefully reasonably self-explanatory as the starting point in a filtered list of requests and the maximum number of requests to return from the starting point in that filtered list of requests. 
 
The key point to take away here is that it is a filtered list of requests. Once you realise this it opens up a raft of possibilities as you can even use your own custom filters to return a list of requests. 
 
Now the catch. Try as you might to replace the ‘filterby’ option with the name of your filter in ServiceDesk Plus it never seem to work as intended. This is where you need a second operation, ‘View Request Filters’, from the API to determine the ‘View ID’ of the filter you want to apply to the returned list of requests:
  
 FilteringReq2
 
 
 
 
Once you’ve determined the ‘View ID’, and this includes any Group filters you may have set for the Technician account you’re using the API key for, you can substitute this in the ‘filterby’ control of the ‘View All Requests’ operation.
 
To help you out I’ve included an example PowerShell script that searches for a custom Group I’ve created in my test system of ‘Case Management’ (for simplicity you can easily test this script in the PowerShell ISE editor replacing the URL, technician key and ‘filterby’ elements). 
 
 # Set system parameters – change these details to suit your system environment
$sdphost = “http://localhost:8888/” 
$techkey = “83460559-E959-4525-B17A-209D2AE698F0”
# Set API module URL and operation
# This is the URL for calling the Request API in order to Reply to a Request # It users the Request ID as a parameter
# It uses the request parameter passed to the script $workorderid
$url = $sdphost + “sdpapi/request/”
$method = “POST”
$operation = “GET_REQUESTS”
# Configure input data for email Reply operation in JSON format
$inputdata = @” 
{
    “operation”: {
        “details”: {
            “from”: “0”,
            “limit”: “10”,
            “filterby”: “Case Management_QUEUE”
        }
    }
}
“@
# Configure paramaters for web API call as an array of object and format as JSON data.
# This is a more elegant method than creating a text string to build the URL
$params = @{INPUT_DATA=$inputdata;OPERATION_NAME=$operation;TECHNICIAN_KEY= $techkey;format=‘json’}
# Make a web API call and record result
$response = Invoke-WebRequest -Uri $url -Method POST -Body $params
# Output Result
write-host $response
In the example you’ll see the ‘View ID’ of the Group ‘Case Management’ is in fact, ‘Case Management_QUEUE’ …… right. of course!
 
Hope this helps.
 
Enjoy!
 
 
 
This article is relevant to:
Service Desk

You may be interested in these other recent articles

Get to building your business apps with the new AppCreator

9 June 2022

ManageEngine’s new low-code application development tool Creating an application, building one and deploying it can be expensive and time consuming as you have to make…

Read more

Endpoint Central’s Endpoint Security

31 May 2022

Endpoint Central (formerly Desktop Central) not only got a name change but has also introduced Endpoint Security to help organisations keep their endpoints secured. According…

Read more

Automation in ManageEngine ServiceDesk Plus

20 December 2021

Increasingly customers are looking to automate repetitive and mundane tasks in ServiceDesk Plus. Since the introduction of Deluge, Zoho’s online scripting language, as part of…

Read more

Update on the recent Apache Log4j2 vulnerability – Impact on ManageEngine on-premise and Zoho cloud products

14 December 2021

A high severity vulnerability (CVE-2021-44228) impacting multiple versions of the Apache Log4j2 utility was disclosed publicly on December 9, 2021. The vulnerability impacts Apache Log4j2…

Read more

Who do I contact for technical support for my ManageEngine product?

10 September 2021

When purchasing a ManageEngine product it will either have been supplied on a subscription basis or it would have included an initial Annual Maintenance and…

Read more