Module for interacting with the ManageEngine ServiceDeskPlus OnDemand API
In order to obtain a temporary authorization code to authenticate to the API with, you first need to register a self-client application via the ZOHO API Client Console. See the ManageEngine API documentation for the full documentation on registration.
Follow the steps in the documentation to generate a temporary authentication code and supply the value to the GrantToken parameter of New-ZohoAccessToken or download the self_client.json file from the API client console and supply the path via the FilePath parameter.
Using the self_client.json file:
$LatestAuthFile = (Get-ChildItem -Path '~\Downloads\self_client*.json' | sort LastWriteTime -Descending)[0]
$ZohoAuth = New-ZohoAccessToken -FilePath $LatestAuthFileOr by specifying your credentials as parameters:
$NewTokenParams = @{
GrantToken = '1000.f74e7b6fc16c95bbc1fa2f067962f84b.9768e796b6273774817032613ba6892a'
ClientId = '1000.15S25B602CISR5WO9RUZ8UT39O3RIH'
ClientSecret = '9ea302935eb150d9d6cbefd35b1eb8891332d815b8'
}
$ZohoAuth = New-ZohoAccessToken @NewTokenParamsThen use the token to interact with the API:
$RequestParams = @{
Status = 'Open', 'Onhold'
Portal = 'is'
Technician = '[email protected]'
AccessToken = $ZohoAuth.access_token
}
$Tickets = Find-ServiceDeskRequest @RequestParamsPowerShell allows you to save default values for parameters via the PSDefaultParameterValues variable.
Add defaults to your PowerShell profile to limit the number of parameters that need to be specified when executing ServiceDeskPlusCloud functions:
# Microsoft.PowerShell_Profile.ps1
$PSDefaultParameterValues['*-ServiceDeskPlus*:Portal'] = 'is'
$PSDefaultParameterValues['Find-ServiceDeskPlusRequest:Technician'] = '[email protected]'First install the Pester module:
Install-Module Pester -ForceYou're ready to run Pester tests:
Invoke-Pester