-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathStart-IPAProcess.ps1
39 lines (33 loc) · 1.07 KB
/
Start-IPAProcess.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<#
# AUTHOR : Pierrick Lozach
#>
function Start-IPAProcess() # {{{2
{
# Documentation {{{3
<#
.SYNOPSIS
Launches an IPA process
.DESCRIPTION
Launches an IPA process.
.PARAMETER ICSession
The Interaction Center Session
.PARAMETER DefinitionId
The process definition id of the process that is to be launched
#> # }}}3
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)] [Alias("Session", "Id")] [ININ.ICSession] $ICSession,
[Parameter(Mandatory=$true)] [Alias("ProcessId")] [string] $DefinitionId
)
#TODO Check if process exist before trying to run it. Get-IPAProcess returns 403 at the moment.
$headers = @{
"Accept-Language" = $ICSession.language;
"ININ-ICWS-CSRF-Token" = $ICSession.token;
}
$body = ConvertTo-Json(@{
"processDefinitionId" = $DefinitionId
})
$response = Invoke-RestMethod -Uri "$($ICsession.baseURL)/$($ICSession.id)/ipa/process-instances" -Body $body -Method Post -Headers $headers -WebSession $ICSession.webSession -ErrorAction Stop
Write-Output $response | Format-Table
[PSCustomObject] $response
} # }}}2