Freshservice is the fastest-growing ITSM vendor - Gartner 2020 Magic Quadrant. Learn More

Start a new topic
Not Taken

Can you export or backup knowledge base solutions?

Is it possible to export the knowledge base solutions? We are keen to populate the knowledge base but then we would be vulnerable if we can't keep a backup of the information.


2 people like this idea

I don't think it is currently possible in the UI. However I believe that Freshservice are planning some updates to the solutions module this year, so potentially this will be looked at.


It is possible if you use the API:


Export folders, one at a time: https://api.freshservice.com/#view_all_solution_article


or to export everything at once you could iterate over categories and folders and then make the previously mentioned api call per folder/category pair: https://api.freshservice.com/#view_all_solution_category


Once you can do this, it would be very easy to schedule as needed.


1 person likes this

Thanks Matthew - I'll give it a try.  
As long as I can get the solutions backed up somehow then I feel happier to commit to putting them all in Freshservice!

   Try this:

$api_key = "API_KEY"

$helpdesk_url = 'https://HELPDESK_URL.freshservice.com'

function normalizePath
{
  param (
    [string]$path
  )
  return $path.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
}
$solutions = @()

$EncodedCredentials = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $api_key, $null)))
$HTTPHeaders = @{ }
$HTTPHeaders.Add('Authorization', ("Basic {0}" -f $EncodedCredentials))
$HTTPHeaders.Add('Content-Type', 'application/json')
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

$url = $helpdesk_url + '/solution/categories.json'
$response = Invoke-WebRequest -Uri $url -Headers $HTTPHeaders | ConvertFrom-Json

$response | ForEach-Object {
  $_category = $_.category.name
  $_.category.folders
} | Select-Object id, category_id, name | ForEach-Object {
  $_url = $helpdesk_url + '/solution/categories/' + $_.category_id + '/folders/' + $_.id + '.json'
  Write-Host $_url
  $categoryResponse = Invoke-WebRequest $_url -Headers $HTTPHeaders | ConvertFrom-Json
  $categoryResponse.folder.articles | ForEach-Object {
    $_folder = $categoryResponse.folder.name
    write-host "Backing up: $($_.title)"
    $solutions += [pscustomobject]@{title = $_.title; content = $_.description; category = $_category; folder = $_folder }
  }
}

$solutions | ForEach-Object {
  $title = normalizePath($_.title)
  $category = normalizePath($_.category)
  $folder = normalizePath($_.folder)
  $path = ".\$category\$folder\"
  if (!(Test-Path $path))
  {
    New-Item -Path $path -ItemType Directory
  }
  $_.content | Out-File -FilePath ($path + "$title.html")
} 

   This is a Powershell script which will export all solutions to html files in the folder structure .\<category name>\<folder name>\<article name>.html


Replace the url and api key placeholders with your own details. Note that embedded media (images,etc ) as well as attachments aren't downloaded so these would need to be exported manually as far as I can tell.

There needs to be a formalised method for this, as it stands with no ability to export, only import it is not a solution it's a lock in. 


Exporting solutions by script is ugly, also exporting without the option of exporting embedded media is an unacceptable workaround IMHO.

Freshservice's is main marketing mantra is ease of use, make this process easy please.


1 person likes this

Hi everyone,

There are two workarounds for getting solutions data:

1. Via the API
2. Using the export option in "Account -> Other Details" tab. This page is visible to account admins of a Freshservice account

We currently don't have export option specifically for solutions in our near term roadmap

Login or Signup to post a comment