-
Notifications
You must be signed in to change notification settings - Fork 6
/
sample16-read-import-document-settings.ps1
88 lines (80 loc) · 2.88 KB
/
sample16-read-import-document-settings.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#import
. "$global:rootDir\Helpers\EndpointsClass.ps1"
$workspaceId = 1000000
$importId = New-Guid
$global:Endpoints = [Endpoints]::new($workspaceId)
Context "Sample16 Read document settings" {
Describe "Create job" {
$uri = $global:Endpoints.importJobCreateUri($importId)
$body = @{
applicationName = "Import-service-sample-app"
correlationID = "Sample-job-0016"
} | ConvertTo-Json -Depth 10
$response = $global:WebRequest.callPost($uri, $body)
$global:WebRequest.checkIfSuccess($response)
Write-Information -MessageData "Job $importId created" -InformationAction Continue
}
Describe "Create document configuration" {
$uri = $global:Endpoints.documentConfigurationUri($importId)
$jobConfigurationBody = '{
"importSettings" :
{
"Overlay":null,
"Native":{
"FilePathColumnIndex": "22",
"FileNameColumnIndex": "13"
},
"Image":null,
"Fields": {
"FieldMappings": [
{
"ColumnIndex": 0,
"Field": "Control Number",
"ContainsID": false,
"ContainsFilePath": false
},
{
"ColumnIndex": 11,
"Field": "Email To",
"ContainsID": false,
"ContainsFilePath": false
}
]
},
"Folder":null
}
}'
$response = $global:WebRequest.callPost($uri, $jobConfigurationBody)
$global:WebRequest.checkIfSuccess($response)
Write-Information -MessageData "Job configuration created" -InformationAction Continue
}
Describe "Read document configuration" {
$uri = $global:Endpoints.documentConfigurationUri($importId)
$value = $global:WebRequest.callGet($uri)."Value" | ConvertTo-Json -Depth 10
Write-Information -MessageData "Configuration: $value" -InformationAction Continue
}
<#Expected output
Configuration: {
"Native": {
"FilePathColumnIndex": 22,
"FileNameColumnIndex": 13
},
"Fields": {
"FieldMappings": [
{
"ColumnIndex": 0,
"Field": "Control Number",
"ContainsID": false,
"ContainsFilePath": false
},
{
"ColumnIndex": 11,
"Field": "Email To",
"ContainsID": false,
"ContainsFilePath": false
}
]
}
}
#>
}