Force canada
This commit is contained in:
@@ -127,7 +127,7 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBox Name="StreetBox" Style="{StaticResource RoundedTextBox}" Tag="Street Address" Grid.Column="0" Margin="0,0,8,0"/>
|
<TextBox Name="StreetBox" Style="{StaticResource RoundedTextBox}" Tag="Street Address" Grid.Column="0" Margin="0,0,8,0"/>
|
||||||
<TextBox Name="CountryBox" Style="{StaticResource RoundedTextBox}" Tag="Country" Grid.Column="1"/>
|
<TextBox Name="CountryBox" Style="{StaticResource RoundedTextBox}" Tag="Canada" Grid.Column="1"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- City + Province + Postal Code -->
|
<!-- City + Province + Postal Code -->
|
||||||
|
|||||||
2
main.ps1
2
main.ps1
@@ -105,6 +105,8 @@ $ITGlueBox.IsEnabled = $false
|
|||||||
$RocketcyberBox.IsEnabled = $false
|
$RocketcyberBox.IsEnabled = $false
|
||||||
$CyberQPBox.IsEnabled = $false
|
$CyberQPBox.IsEnabled = $false
|
||||||
|
|
||||||
|
$CountryBox.IsEnabled = $false
|
||||||
|
|
||||||
$AutotaskBox.Add_Checked({
|
$AutotaskBox.Add_Checked({
|
||||||
$PhoneBox.Visibility = 'Visible'
|
$PhoneBox.Visibility = 'Visible'
|
||||||
$WebsiteBox.Visibility = 'Visible'
|
$WebsiteBox.Visibility = 'Visible'
|
||||||
|
|||||||
@@ -1,21 +1,30 @@
|
|||||||
function Invoke-AutotaskProvision {
|
function Invoke-AutotaskProvision {
|
||||||
param (
|
param (
|
||||||
[Parameter(Mandatory)][string]$CompanyName,
|
[Parameter(Mandatory)]
|
||||||
[Parameter(Mandatory)][string]$PhoneNumber,
|
[string]$CompanyName,
|
||||||
|
|
||||||
|
[Parameter(Mandatory)]
|
||||||
|
[string]$PhoneNumber,
|
||||||
|
|
||||||
[string]$Website,
|
[string]$Website,
|
||||||
[string]$Street,
|
[string]$Street,
|
||||||
[string]$City,
|
[string]$City,
|
||||||
[string]$Province,
|
[string]$Province,
|
||||||
[string]$PostalCode,
|
[string]$PostalCode,
|
||||||
[string]$Country,
|
[string]$Country, # Not used but accepted for compatibility
|
||||||
[Parameter(Mandatory)][hashtable]$Credentials
|
|
||||||
|
[Parameter(Mandatory)]
|
||||||
|
[hashtable]$Credentials
|
||||||
)
|
)
|
||||||
|
|
||||||
if (-not $Credentials["AutotaskURL"] -or -not $Credentials["AutotaskIntCode"] -or -not $Credentials["AutotaskUsername"] -or -not $Credentials["AutotaskSecret"]) {
|
if (-not $Credentials["AutotaskURL"] -or
|
||||||
|
-not $Credentials["AutotaskIntCode"] -or
|
||||||
|
-not $Credentials["AutotaskUsername"] -or
|
||||||
|
-not $Credentials["AutotaskSecret"]) {
|
||||||
throw "Missing Autotask credentials in hashtable."
|
throw "Missing Autotask credentials in hashtable."
|
||||||
}
|
}
|
||||||
|
|
||||||
$Url = "https://$($Credentials["AutotaskURL"])/atservicesrest/v1.0/companies"
|
$BaseUrl = "https://$($Credentials["AutotaskURL"])/atservicesrest/v1.0/companies"
|
||||||
|
|
||||||
$Headers = @{
|
$Headers = @{
|
||||||
"ApiIntegrationcode" = $Credentials["AutotaskIntCode"]
|
"ApiIntegrationcode" = $Credentials["AutotaskIntCode"]
|
||||||
@@ -38,7 +47,7 @@ function Invoke-AutotaskProvision {
|
|||||||
} | ConvertTo-Json -Depth 3
|
} | ConvertTo-Json -Depth 3
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Response = Invoke-RestMethod -Uri $Url -Method Post -Headers $Headers -Body $Body
|
$Response = Invoke-RestMethod -Uri $BaseUrl -Method Post -Headers $Headers -Body $Body
|
||||||
return $Response.itemId, $Response.id, $Response.companyID, $Response.item.id | Where-Object { $_ } | Select-Object -First 1
|
return $Response.itemId, $Response.id, $Response.companyID, $Response.item.id | Where-Object { $_ } | Select-Object -First 1
|
||||||
} catch {
|
} catch {
|
||||||
throw "[Autotask] Provisioning failed: $($_.Exception.Message)"
|
throw "[Autotask] Provisioning failed: $($_.Exception.Message)"
|
||||||
|
|||||||
Reference in New Issue
Block a user