Export and import services

This article describes how to export a service and its associated process, and how to import the service in another ZervicePoint instance using ZervicePoint PowerShell Management.

Exporting a service and its associated process

Provider modules used by forms and activities are not included in the exported process. They must be copied manually.

  1. Set the ZervicePoint Powershell environment variables (ZPAPIURL, ZPAPIADFSHOST and ZPAPIAUDIENCEURI) if not already set
  2. Import the ZervicePoint Powershell module
  3. Acquire a security token from your ADFS server

    Not required if you are using an API Key

  4. Use the Get-ZPService cmdlet to get the service you want to export

  5. Convert the service object to JSON and save to file
  6. Use the Get-ZPProcess cmdlet to get the process associated with the service
  7. Convert the process object to JSON and save to file

Export service and template

$env:ZPAPIURL = "https://zervicepoint.dev.local:30000/Store"
$env:ZPAPIADFSHOST = "authx.dev.zipper.se"
$env:ZPAPIAUDIENCEURI = "https://zervicepoint.dev.local/"

Import-Module "C:\Program Files\Zipper\ZervicePoint\PowerShell\ZervicePoint.WebApi.PowerShell"

Get-ZPSecurityToken | Set-ZPSecurityToken

$service = Get-ZPService | Where { $_.Name -Eq "TestService" }
$serviceJson = ConvertTo-ZPJson -Service $service
$serviceJson | Out-File "C:\Temp\TestService.json"

$process = Get-ZPProcess -UniqueId $service.ProcessUniqueId
$processJson = ConvertTo-ZPJson -Process $process
$processJson | Out-File "C:\Temp\TestServiceProcess.json"

Importing a service and process

Before importing a service you must manually copy any provider modules used by forms and activities in the source service. Also make sure the modules and methods are inventoried before proceeding.

  1. Set the ZervicePoint Powershell environment variables (ZPAPIURL, ZPAPIADFSHOST and ZPAPIAUDIENCEURI) if not already set
  2. Import the ZervicePoint Powershell module
  3. Acquire a security token from your ADFS server

    Not required if you are using an API Key

  4. Use the Get-Content cmdlet to read the contents of the service and process files

  5. Convert the JSON strings to actual service and process objects using ConvertFrom-ZPJson
  6. Use the New-ZPProcess cmdlet with the -PassThru switch to create the process
  7. Set the ProcessUniqueId property on the service object to point to the newly created process
  8. Use the New-ZPService cmdlet to create the service

Import service and template

$env:ZPAPIURL = "https://zervicepoint.dev.local:30000/Store"
$env:ZPAPIADFSHOST = "authx.dev.zipper.se"
$env:ZPAPIAUDIENCEURI = "https://zervicepoint.dev.local/"

Import-Module "C:\Program Files\Zipper\ZervicePoint\PowerShell\ZervicePoint.WebApi.PowerShell"

Get-ZPSecurityToken | Set-ZPSecurityToken

$serviceJson = Get-Content "C:\Temp\TestService.json"
$processJson = Get-Content "C:\Temp\TestServiceProcess.json"

$service = $serviceJson | ConvertFrom-ZPJson -OutputObject Service
$process = $processJson | ConvertFrom-ZPJson -OutputObject Process

$newProcess = New-ZPProcess -Object $process -PassThru
$service.ProcessUniqueId = $newProcess.UniqueId
$newService = New-ZPService -Object $service -PassThru