Freshservice Powershell Module.
If you use SSO (single sign-on), you HAVE TO use the API Key method to connect!!!
This module offers two ways to connect to Freshservice (Username and Password | Freshservice API Key). In order to get your API Key you'll need to log into your account, go to 'Profile Settings' and your API Key will be on the right hand side.
How to get Freshservice API Key
Connect-Freshservice -ApiKey <#-or-#> -Username -Password <#-and-#> -Domain- Within the
-Domainparameter, you DO NOT have to supply the entire domain name!!!- If your domain is
google.comthen you only need to usegooglefor this parameter!!!
- If your domain is
Set-RequiredSecurityProtocol- This command is invoked automatically during module import you do not have to manually run this command yourself!
- This command is ran during module import
- it is needed to talk to the Freshservice API - it sets the appropriate encryption types for the session and MUST BE RAN EACH TIME YOU IMPORT THE MODULE!!
New-FreshserviceApiRequest -ApiUrlQuery <#-or-#> -ApiUrlFull <#-and-#> -RequestMethod -ContentType <#-or-#> -AsWebRequestNew-FreshserviceApiRequestis the 'core' function that the majority of other functions 'wrap' around, specifically the ones that interact with the API via REST- This command itself is nothing more than a wrapper for
Invoke-RestMethod- although, supplying the switchAsWebRequestwill useInvoke-WebRequestinstead ofInvoke-RestMethod(whileInvoke-WebRequestandInvoke-RestMethoddo the same thing, the data they return is different -Invoke-WebRequestlets you parse headers, etc..)- The
Connect-Freshservicecommand must be ran before you are able to useNew-FreshserviceApiRequest -ApiUrlQuerymeans you only have to supply everything after the root domain/host- ex: (
/api/v2/agents)
- ex: (
-ApiUrlFullmeans you have to supply the full URL- ex: (
https://domain.freshservice.com/api/v2/agents)
- ex: (
- You can use
New-FreshserviceApiRequeston its own (as long as you use-ApiUrlFull)
- The
ConvertTo-Base64 -StringToEncodeConvertFrom-Base64 -EncodedStringConfirm-StringIsUri -StringGet-FreshserviceAgent -Id <#-or-#> -State <#-(fulltime|occasional)-#> <#-or-#> -Email <#-or-#> -MobilePhone <#-or-#> -WorkPhone- If parameters are not used, all Agents are returned
Get-FreshserviceTicket -TicketId <#-or-#> -RequesterEmail <#-or-#> -TicketFilter <#-(new_and_my_open|monitored_by|spam|deleted)-#>- If parameters are not used,
all1000 Tickets are returned - DEFAULT MAX RETURN FOR TICKETS IS 1000 TICKETS; EACH TIME YOU RUN THIS COMMAND
- The API is rate limited by Freshservice
Read-FreshserviceTicketQueue -Tickets <#-and/or-#> -MaxReturn <#-(max size is 1000)-#>- Used inside of
Get-FreshserviceTicketto iterate through each page of tickets- This is because the Freshservice API will only return 100 tickets per page at most
New-FreshserviceTicketGet-FreshserviceRequester -Id <#-or-#> -Email <#-or-#> -MobilePhone <#-or-#> -WorkPhone- If parameters are not used, all Requesters are returned