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.
- Set the ZervicePoint Powershell environment variables (ZPAPIURL, ZPAPIADFSHOST and ZPAPIAUDIENCEURI) if not already set
- Import the ZervicePoint Powershell module
-
Acquire a security token from your ADFS server
Not required if you are using an API Key
-
Use the Get-ZPService cmdlet to get the service you want to export
- Convert the service object to JSON and save to file
- Use the Get-ZPProcess cmdlet to get the process associated with the service
- 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.
- Set the ZervicePoint Powershell environment variables (ZPAPIURL, ZPAPIADFSHOST and ZPAPIAUDIENCEURI) if not already set
- Import the ZervicePoint Powershell module
-
Acquire a security token from your ADFS server
Not required if you are using an API Key
-
Use the Get-Content cmdlet to read the contents of the service and process files
- Convert the JSON strings to actual service and process objects using ConvertFrom-ZPJson
- Use the New-ZPProcess cmdlet with the -PassThru switch to create the process
- Set the ProcessUniqueId property on the service object to point to the newly created process
- 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