Skip to main content

Our company, Flycast Partners, is a Value Added Reseller (VAR) and Professional Services organization for ITSM.  We have implemented hundreds of Freshservice customers which almost always requires data migration, imports and integrations with applications.  As we leveraged Powershell frequently to solve issues, a Powershell module slowly evolved. The module is open-source on Github and hosted on the Microsoft Powershell Gallery for simple installation and is free to the public to support the Freshworks community.

 

The module has all Freshservice API endpoints mapped to date and has built-in help documentation.  Here are some highlights on how the module extends and simplifies Freshservice administration:

  • Automatic paging - running Get-FSTicket will return all pages without additional code. 
  • Quickly connect to multiple instances - Create connections with New-FSConnection to Sandbox and Production instances.  Then quickly connect to instances with Connect-FS.
  • Import data with simple commands\scripts - Using the pipeline, you can import data very quickly.  Check out an example of creating some departments.
PS C:\FreshservicePS> 
#$depts = Import-Csv -Path C:\mydepts.csv
#Emulate CSV Import - The csv headers match the command parameters (e.g. New-FSDepartment -name dept1 -description 'Department 1')
$depts = @"
name,description
dept1,Department 1
dept2,Department 2
dept3,Department 3
"@ | ConvertFrom-Csv

$depts | New-FSDepartment

description : Department 1
custom_fields :
id : 21000433904
name : dept1
created_at : 9/22/2023 2:47:40 PM
updated_at : 9/22/2023 2:47:40 PM
prime_user_id :
head_user_id :
domains : {}

description : Department 2
custom_fields :
id : 21000433905
name : dept2
created_at : 9/22/2023 2:47:41 PM
updated_at : 9/22/2023 2:47:41 PM
prime_user_id :
head_user_id :
domains : {}

description : Department 3
custom_fields :
id : 21000433906
name : dept3
created_at : 9/22/2023 2:47:41 PM
updated_at : 9/22/2023 2:47:41 PM
prime_user_id :
head_user_id :
domains : {}
  • Get verbose output for Development - Show the details of the API calls being made to support external or workflow development. 
PS C:\FreshservicePS> Set-FSDepartment -id 21000433905 -description 'Department two rules!' -Verbose
VERBOSE: Performing the operation "Set-FreshServiceDepartment" on target "https://its-fine.freshservice.com/api/v2/departments/21000433905".
VERBOSE: Appending Authorization header
VERBOSE: Invoke-FreshworksRestMethod - Initiating REST API call to https://its-fine.freshservice.com/api/v2/departments/21000433905 with API key: Tm90TXlSZWFsQVBJS2V5Oik=
VERBOSE: Invoke-FreshworksRestMethod - REST call parameters:
VERBOSE: Invoke-FreshworksRestMethod - Method: PUT
VERBOSE: Invoke-FreshworksRestMethod - Headers:
VERBOSE: Invoke-FreshworksRestMethod - Authorization: Basic Tm90TXlSZWFsQVBJS2V5Oik=
VERBOSE: Invoke-FreshworksRestMethod - Uri: https://its-fine.freshservice.com/api/v2/departments/21000433905
VERBOSE: Invoke-FreshworksRestMethod - ContentType: application/json
VERBOSE: Invoke-FreshworksRestMethod - ErrorAction: Stop
VERBOSE: Invoke-FreshworksRestMethod - Body: {
"description": "Department two rules!"
}
VERBOSE: Invoke-FreshworksRestMethod - Invoking REST PUT Method on ...
VERBOSE: Invoke-FreshworksRestMethod - Forcing TLS 1.2 protocol for invoking REST method.
VERBOSE: HTTP/1.1 PUT with 46-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Returned status OK with code 200.
VERBOSE: Current FreshService minute rate limit is 500 with 498 calls remaining (0.4% used) .
VERBOSE: Invoke-FreshworksRestMethod - Completed REST PUT Method on in 00:00:00.2646207.
VERBOSE: Returning department property with count 1

description : Department two rules!
custom_fields :
id : 21000433905
name : dept2
created_at : 9/22/2023 2:47:41 PM
updated_at : 9/22/2023 3:08:47 PM
prime_user_id :
head_user_id :
domains : {}
  • Module Throttling - There is soft throttling in the module that will artificially slow down API calls in an effort to not hit API throttle limits.  If limits are exceeded, the module also is built to automatically sleep if a 429 occurs.
  • Many use cases - Data import\export, managing agents\requesters\groups, DevOps\CI, adding\updating CMDB records, contracts, etc.

We hope it assists the community managing their Freshservice instance(s). Need help getting started, check out our landing page and Getting Started guide:

https://www.flycastpartners.com/freshserviceps

Hello @rasimm, this is amazing! Well done. I can tell you that I am confident this will become a valuable resource for all Freshservice Administrators and community members.

Keep up the great work and really appreciate the drive to support the community with beneficial tools.

Look forward to sharing this with my administrators as a quick way to build those necessary integrations into Freshservice.

Thanks again!


If I’m reading everything correctly, there’s no way to update a Service Request using FreshServicePS?
Incidents can be updated using “Set-FSTicket” but not Service Requests?


If I’m reading everything correctly, there’s no way to update a Service Request using FreshServicePS?
Incidents can be updated using “Set-FSTicket” but not Service Requests?

What I’m really looking for is 
api/v2/ticket/{ticket_id}?bypass_mandatory=true

When Updating a Ticket.
Not sure how to implement that without creating a whole fork.


That is really useful! Especially the automatic paging feature with caracter invisible Get-FSTicket—it must save a lot of time for admins handling large datasets.


Reply