/
Add-AeriesAlternateCourseRequest.ps1
66 lines (53 loc) · 1.95 KB
/
Add-AeriesAlternateCourseRequest.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
function Add-AeriesAlternateCourseRequest
{
<#
.SYNOPSIS
Add an Alternate Course Request to Aeries
.DESCRIPTION
The Add-AeriesAlternateCourseRequest cmdlet is used to add an Alternate Course Request in Aeries for a given StudentID and SchoolCode
.EXAMPLE
Add-AeriesAlternateCourseRequest -SchoolCode 994 -StudentID 99400001 -CourseNumber "123456"
This will create an Alternate Course Request in Aeries for StudentID 99400001 at SchoolCode 994 with Course Number 123456
#>
[CmdletBinding()]
param (
[ValidateRange(1, [Int16]::MaxValue)]
[Parameter(Mandatory=$true)]
[Int16]
$SchoolCode,
[ValidateRange(1, [Int]::MaxValue)]
[Parameter(Mandatory=$true)]
[int]
$StudentID,
[ValidateLength(1, 6)]
[Parameter(Mandatory=$true)]
[string]
$CourseNumber,
[ValidateRange(1, [Int]::MaxValue)]
[Parameter(Mandatory=$false)]
[Int]
$RelativePrioritySortOrder = -1
)
Begin {
Write-Verbose -Message "Begin running $($MyInvocation.MyCommand)"
$Method = "Post"
$SuccessStatusCode = 201
$Endpoint = "v5/schools/$SchoolCode/students/$StudentID/alternatecourserequests"
$ContentType = "application/json"
$Body = @{}
}
Process {
$Body.CourseID = $CourseNumber
If ($RelativePrioritySortOrder -gt -1) {
<# Int Value #>
$Body.RelativePrioritySortOrder = $RelativePrioritySortOrder
}
<# Turn the $Body variable into a JSON string for sending to the server #>
$BodyJSON = ($Body | ConvertTo-Json -Compress)
$Result = (Invoke-AeriesApiCall -Method $Method -Endpoint $Endpoint -SuccessStatusCode $SuccessStatusCode -Body $BodyJSON -ContentType $ContentType)
}
End {
Write-Verbose -Message "Finish running $($MyInvocation.MyCommand)"
return $Result
}
}